4 ms·
the constexpr stuff has been around since the beginning[0]. concretely, what other thing from D do you claim zig has added since? [0] minimally 2019, 3 years
by throwawaymaths 2y ago
the constexpr stuff has been around since the beginning[0]. concretely, what other thing from D do you claim zig has added since?
[0] minimally 2019, 3 years in:
https://youtu.be/Gv2I7qTux7g?si=p0kVhtB56GvVLLNr https://youtu.be/Gv2I7qTux7g?si=p0kVhtB56GvVLLNr
- WalterBright 2y agoD had compile time execution of functions in 2007. Order-independent top level declarations. Underscores embedded in integer literals. (I stole this idea from Ada, which had been forgotten. Soon after D popularized it, it became standard in other languages.) Continue or break to labeled loop. Fixed sizes for ints, longs, etc. Of course, I don't know if there's a straight line here, and Zig is welcome to use any features from D that they like. But it's just interesting that things innovated in D pop up in subsequent designs.
- UncleEntity 2y ago>> Continue or break to labeled loop. Hasn't Java had that since the beginning? rummaging around in my grammar folder... BreakStatement ::= "break" [ IDENTIFIER ] ';' ContinueStatement ::= "continue" [ IDENTIFIER ] ';'
- WalterBright 2y agoAnd so it does. I had forgotten. Thanks for the reminder!
- sundarurfriend 2y ago> Underscores embedded in integer literals. Perl had this years before D even existed [1]. Given its earlier age and higher reach, it's likely that Perl did more to popularize the idea as well. > Continue or break to labeled loop. Also a feature that Perl had years before D's existence [2]. These two are the ones I immediately recognized because of my familiarity with Perl, but given the trend, I'm doubtful of the other claims as well now. [1] https://perldoc.perl.org/5.005/perldata https://perldoc.perl.org/5.005/perldata [2] https://perldoc.perl.org/5.005/perlsyn#Loop-Control https://perldoc.perl.org/5.005/perlsyn#Loop-Control
- WalterBright 2y agoI did not know Metaware and Perl did this, as I've never used either. I know that my inspiration for it came from Ada. I accept that Metaware and Perl did this before D. But I still claim that adoption of it in other languages came shortly after I popularized it in D, as I included it in many presentations about it.
- dfawcus 2y agoMetaware High-C version 1.2 (Nov 1985) had underscores in floating point and integer literals. Possibly it had that even earlier. Possibly also taken from Ada, as other text in that section of the manual reference Ada. See A.3 pg 169 (and 58+) of 235 in: https://bitsavers.org/pdf/metaware/High_C_Language_Reference_Manual_1.2_Nov85.pdf https://bitsavers.org/pdf/metaware/High_C_Language_Reference...
- WalterBright 2y agoI did not know that. Thanks for pointing it out.
- dfawcus 2y agomind, it is also possible that they took that from Algol 68, and 'adjusted it': $ a68g --strict -e '(INT a = 1 000; print((a,newline)) )' +1000 As Algol 68 allows spaces within numbers, as well as within identifiers.
- throwawaymaths 2y ago> Order-independent top level declarations. Javascript has had this for functions since 1995. This has been part of zig from the start, not added later. > Fixed sizes for ints, longs, etc. this has existed in stdint.h since C99. It doesn't take a genius, only years of pain with C/C++, to realize this is the better way to do things. And also, this was in zig from the start, not added later. > Underscores embedded in integer literals Also in zig from the start, not added later. Others have commented on the provenance. I could be convinced that continue/break to labels was inspired by D.