14 ms·
High C Compiler – A C language extension ahead of its time
- Agingcoder 3y agoAll of them apart from generators look like they were taken straight from Ada.
- WalterBright 3y agoD has _ in integers and that did come straight from Ada. I always liked Ada.
- brabel 3y agoAs I was reading I was thinking High C looks a lot like D! Though D still has no named parameters :D (I know it's in the works).
- WalterBright 3y agoDennis Korpel has nearly finished the named parameters. Yes, rest does look like D, such as nested functions! C still doesn't have nested functions. Once you get accustomed to them, they are really useful.
- brabel 3y agoLooking forward to named parameters, they help so much when functions take more than 2 or 3 parameters. By the way, I've been doing some D lately, just as a hobby, but it's been really nice! I had no idea before that D had so many features (I would say it even has too many - but still quite nice).
- WalterBright 3y agoD does in some ways have too many features. We'd like to prune out some of them. I agree that named parameters can be very helpful. For example, if there are three bool arguments, it makes calls like: test(true, false, false); into: test(format: true, output: false, skip: false); which makes it much more readable.
- pjmlp 3y agoPascal predates Ada, and already had ranges, CLU and Modula-2 also predate Ada and had generators.
- kragen 3y agoi know icon had generators, but i don't think it predated ada. did snobol4, icon's very different predecessor, have generators?
- pjmlp 3y agoQuite easy to find out, Ada released to the world in 1983, Icon released to the world in 1977.
- kragen 3y agoit's a bit more complex than that; ironman was already written in january 01977, for example https://dl.acm.org/doi/pdf/10.1145/234286.1057816 https://dl.acm.org/doi/pdf/10.1145/234286.1057816 §5.3.4 p.197 (25/60) i'm not sure if ironman listed generators as a requirement or not; i suspect they were added later this paper doesn't mention clu, modula-2, or icon as influences, for whatever that's worth
- pjmlp 3y agoSince we are doing archeology, https://dl.acm.org/doi/10.1145/154766.155376 https://dl.acm.org/doi/10.1145/154766.155376 We come to https://link.springer.com/book/10.1007/BFb0021415 https://link.springer.com/book/10.1007/BFb0021415 from the references, with an interesting table of contents. Similar approach can be done for other quoted references, if one is really keen in who did it first, and how much the Ada folks were aware of them. Naturally since not all of them are scanned, it is going to be a lot of work.
- eesmith 3y agoArchive.org has two scans of "Design and implementation of programming languages : proceedings of a DoD sponsored workshop, October, 1976, Ithaca". One is at https://archive.org/details/designimplementa0054unse_u4m7/mode/2up https://archive.org/details/designimplementa0054unse_u4m7/mo...
- mynameisnoone 3y agoI can't read "Fujitsu" without immediately thinking of a public-private partnership post office software debacle where a software error is exploited by unsupervised private prosecutors incentivized by financial reasons (finder's commissions) to wrongly accuse, extort, and imprison hundreds of subpostmasters.
- kragen 3y agoyou may be overgeneralizing a bit there are 18 sovereign countries in https://en.wikipedia.org/wiki/List_of_countries_and_dependencies_by_population https://en.wikipedia.org/wiki/List_of_countries_and_dependen... with smaller populations than fujitsu, and 31 with smaller economies than fujitsu https://en.wikipedia.org/wiki/List_of_countries_by_GDP_(nominal) https://en.wikipedia.org/wiki/List_of_countries_by_GDP_(nomi...
- ithkuil 3y agoReminds me of Martha Wells' sci-fi novel series Murderbot Diaries, and the corporations in the Corporation Rim
- mynameisnoone 3y agoWhat are you talking about? Did you watch the drama or the documentary that finally spurred the UK gov to partially redress this absurd scandal?
- kragen 3y agono, of course not, watching documentaries is a waste of time that makes you actively less informed than you were before watching them; your irrational knee-jerk response to the word 'fujitsu' is a perfect example of this
- NikkiA 3y agoWell, they weren't 'Fujitsu' at the time though, they were still British company 'ICL' ('International Computers Limited') in 1999. The post hoc insistance on using it's rebrand helps with the 'othering' of making it sound like a foreign company doing all the dodgy shit.
- Doubtme 3y ago[dead]
- deleted 3y ago[deleted]
- buserror 3y agoCase ranges are in gcc for a million years. And also nested functions. I used nested functions a lot but, it was never ported to clang which makes it a bit of a problem for portability, also, nowadays the linker complains about having to make the stack executable, which is another problem; so I had to stop using them. I also don't understand why the "C standard" hasn't evolved further -- there was a discussion lately about the committee being out of touch. Some of these extensions makes life so much easier. Instead we get stupid stuff nobody need, or have been in a header for 200 years (ie, <pthread.h>, whoohoo, I'm delighted this standard header is now a... standard!) For nested/sub function, it makes so much sense it's not even funny. Having micro-callbacks right there before the call to qsort() (or any other) is SO much better than having to farm out a context, yet-another-static-function etc...
- actionfromafar 3y ago“ Nested functions can even goto back into their parent function, allowing for nonlocal exits to break out of nested functions like Smalltalk blocks, allowing control flow-like functions to be built using them.” Wild! Makes one wonder how something could have evolved if it took C and made it more “functional” and/or smalltalk-ish, without going the dynamic way of ObjectiveC. I don’t exactly love C++ but I find it very useful. Maybe I could have loved that other never conceived C offspring.
- derefr 3y agoNote that this functionality is already in C — in the form of the setjmp/longjmp functions, which indeed allow you to have a parent function that contains "global" error-handling, and then a hierarchy of child functions designed to only be executed from that parent, that can "jump out" to the parent's error handler. (But where "parent" and "child" here are just a conceptual relationship the programmer is keeping track of, not anything the compiler knows about.) The difference is that High C gives you lexically-nested function definitions, thus making labels into things like local variables that have scope + shadowing. And so it becomes sensible — necessary, really, to have a coherent semantics — to extend the (runtime, dynamic) longjmp, into a compile-time-targeted, lexical, syntax-sugared version that jumps to in-scope labels (incl. ones defined outside the current lexically-nested function definition.) If you didn't, then you'd have to decide on what a `goto` to an in-scope but out-of-function label would do instead — compiler error, maybe? — and whatever you choose, it would probably be just as hard to implement as just making it work. (Most of the effort is in extending the CFG to allow some analysis pass to notice that this is happening, after all.)
- ikurei 3y agoI love named parameters. Whenever I use Python or Swift, I hate having to come back to languages like C or Javascript that don't have them. It just seems like such a clear win to me, that and writing long numbers like 1_000_000. So much more readable. Why aren't these features more common? I'm a bit surprised Typescript never added them. Are they too difficult to implement in compilers/interpreters? Do they cause too many issues for interop? I'm honestly curious. Is it just that not that many people find these features appealing? PD: I know you can emulate named parameters using objects in JS/TS. I don't love the performance consequences of this; it's good in some situations, but terrible in others.
- mananaysiempre 3y agoC23 has C++14-compatible separators in numbers, as in 1'000'000. (Not sure why they didn’t use underscores.) Unfortunately, strtol and friends haven’t been extended accordingly.
- boxed 3y agoIn python the int parser was quietly changed to accept underscores as valid ints. This has bitten me very bad in production. Imo this was a very bad idea.
- 9dev 3y agoHow did this cause problems for you?
- boxed 3y agoOne system checked if it was a valid int by running `int(x)`, deciding that it was, and passing it to the other system. The second system ran a python version BEFORE this change, while the first system was a newer version. BOOM. That was the first issue. But this made me extremely fearful in the general case, as parsing a number incorrectly can have quite dire consequences when dealing with money for example. So suddenly accept any random string of numbers interspersed at random places with underscores is a Bad Thing, and not a tiny little implementation detail to push through the most popular programming language in the world without any discussion.
- andrewstuart 3y agoGenerators in C in 1989? Seems to me some programmer from the future has journeyed to the past to design High C. Gives me a slight urge to write some High C, an urge I’ll never follow through on.
- Joker_vD 3y agoGenerators were introduced in 1975, in the CLU language, alongside with other things such as exceptions (as they are commonly understood today), variant types, and bounds on the generic's parameters.
- tpmp313459 3y agoThe concept of C is still king or queen of all languages for most of the programs [I'm don't know about FORTRAN]. Eventhough I'm working with Python, Java & Swift I love C language among all modern programming languages. C is very straight forward. C is really great design. [I hate RUST's annoying syntax]
- zilti 3y agoYou might like Zig.
- bsenftner 3y agoI worked using the High C compiler in my first post-university job back in '88-'89, working for PacTel Teletrac, an early street mapping and vehicle tracking division of PacTel. I was formerly one of the beta developers for the Mac, and my job was creating the GUI subsystem for the Teletrac application. The High C Compiler was fast, I remember that, as I was used to getting a cup of coffee when compiling anything decent sized back in the late 80's, and High C compiled too fast for a cup. Of the non-standard C features available in the High C Compiler: we were not allowed to use any of them, they were seen as proprietary locks that would render our application unable to change compilers if needed. Anyone remember Ted Gruber's FastGraph?
- cubicme 3y agoIt's like Ruby's grandfather
- UncleOxidant 3y agoYeah, I wonder if Matz had this manual?
- markosDL 3y agoIf we had switch ranges in C many other languages wouldn't be...
- sigsev_251 3y agoWell, good news, there is a new proposal [1] arguing for their inclusion in the language. You can express your support for it to the committee. [1]: https://open-std.org/JTC1/SC22/WG14/www/docs/n3194.htm https://open-std.org/JTC1/SC22/WG14/www/docs/n3194.htm
- speps 3y agoNo clue what FlexOS is but High C v1.7 seems to be there: https://archive.org/details/mwhc17flexos https://archive.org/details/mwhc17flexos Maybe it can be "ported" to some other kind of OS.
- dfawcus 3y agoIt is (or was) a real time protected mode OS for 286 processors. I actually used that compiler over 25 years ago, it generates Intel OMF files with 8086/80186/80286 - As I recall one can select the target. So post compiling, one should be able to link the result to target a DOS machine, VM, or even Dosbox. I'd suggest porting it, but rather simply simulating the FlexOS SVCs, since it doesn't really need any of the RT capabilities, merely the file access, memory allocation / free, and possibly execution (COMMAND SVC). The package contains two forms of the compiler, a single executable version, and an overlaid version. The non overlaid version would be easiest to get working in such a simulated approach, as one would not have to implement the OVERLAY SVC.
- speps 3y agoNice details! Do you have a contact in case someone wants to pick that up as a side project?
- dfawcus 3y agoContact details for myself, if that is what you meant, should be irrelevant. Most (if not all) the needed information will be available in the documents under this directory: https://bitsavers.org/pdf/digitalResearch/flexos/ There are also copies of the OS available here: https://bitsavers.org/bits/DigitalResearch/FlexOS/
- bvrmn 3y ago> A function nested in a generator can capture the yield operation from the outer generator, and the nested function can call itself recursively to traverse a tree or other recursive data structure, yield-ing at each level to produce values for the generator. I don't think you can do that in Python or in many other mainstream languages with generator coroutines. Automatic yield flattening is a scary feature. Python has explicit control via `yield from`.
- deleted 3y ago[deleted]
- gumby 3y agoLots of good memories and insights in this article. The 80s and 90s were a time of interesting experimentation in the Japanese PC market. Sadly it eventually it converged into the grey goo of baseline Wintel, just as the contemporaneous and exciting world of keitai just ended up as the same boring smartphones as everywhere else. Standardization of things like POSIX and languages ironically has the effect of reducing extensions -- most people write to the standard for maximum portability. I do it too. I'm not a fan of single-implementation languages* (python, pearl, go, rust etc) but at least they do hark back to a time when languages really were written with greater programmer affordances (just as CISC machines had all sorts of affordances for writing applications in assembly code, such as BCD instructions, string maninipulation, etc). * Yes, I know about gccgo and rust-gcc but both were written to be compatible with the original implementation rather than to an independent standard. So de facto those are single-implementation languages.
- aamargulies 3y agoThe High C Compiler was designed and built by the geniuses at MetaWare: Frank deRemer (MIT) and Tom Pennello (UCSC), the pair who invented LALR2 parsing. I worked there in the early 90s, great memories of Tom editing compiler code in his windows terminal so quickly that the screen couldn't update fast enough to keep up with him, he continued editing 'in the blind' on unseen code. Those two are/were seriously gifted computer scientists and they gave me my start in the software industry.
- kencausey 3y agoOn what platform did development take place?
- aamargulies 3y agoWe all had windows machines on our desks, but MetaWare made cross-compilers for the complete cross product of every flavor of CPU and OS. So lots of SunOS/Solaris servers, BSD, IBM 360, Irix, etc servers on the network.
- kencausey 3y agoThanks, I was thinking of early development which I'm assuming is well before the existence of Windows. However I understand you may not have awareness of this period of development.
- aamargulies 3y agoLikely on UCSC's VAXen running BSD4.2.
- aamargulies 3y agohttps://en.wikipedia.org/wiki/LALR_parser https://en.wikipedia.org/wiki/LALR_parser https://dl.acm.org/doi/pdf/10.1145/69622.357187 https://dl.acm.org/doi/pdf/10.1145/69622.357187