5 ms·
I was curious for exactly how long "many years" was, and it appears it was added sometime between 2016 to 2017. The last archive without it is from 2016, the ne
by jchw 3y ago
I was curious for exactly how long "many years" was, and it appears it was added sometime between 2016 to 2017. The last archive without it is from 2016, the next archive with it is 2017:
https://web.archive.org/web/20160405080736/https://dlang.org/phobos/std_algorithm_searching.html https://web.archive.org/web/20160405080736/https://dlang.org...
Now that's of course just the website feature. Maybe D had executable examples that were tested by the compiler before Go, which would still be very interesting. However, it does appear Go at least did have the in-browser feature as far back as 2015:
https://go.dev/blog/examples https://go.dev/blog/examples
Not that this matters for much other than historical interest: good ideas like this should be copied shamelessly (and obviously it's not a terribly original idea to begin with, just a good implementation of it.)
- WalterBright 3y ago> Maybe D had executable examples that were tested by the compiler before Go Sounds like D's ability to specify unit tests in production source code, and have them optionally executed, fits the bill for that. https://dlang.org/spec/unittest.html https://dlang.org/spec/unittest.html Builtin unit tests were a great leap forward for code verification.
- jchw 3y agoHaving unit testing built-in to the programming language and tooling is a huge plus, absolutely. I don't know who originally came up with this, but I swear, it would be worth some recognition :) (And thankfully, whoever did originally come up with this idea, it has been copied a ton by the recent crop of programming language designs.)
- abecedarius 3y agoThe E language supported doctests when I came to it in the 90s: http://erights.org/elang/tools/updoc.html http://erights.org/elang/tools/updoc.html It's the earliest I'm aware of.
- WalterBright 3y agoQuite a few D features have made it into other languages: 1. integrated documentation 2. unit tests 3. 1_000_000 literals 4. ranges 5. compile time function execution 6. static if
- pjmlp 3y agoUnless there is a time machine to have D come up before Smalltalk and Common Lisp/Interlisp-D, it definitely did not do 1, 2 and 3 as influence to other languages.
- WalterBright 3y agoThose languages have indeed been around decades before D. But somehow those features did not move into the general language community until after D was very successful with them and popularized those features in a modern language. BTW, the 1_000_000 specifically came from Ada 1983.
- pjmlp 3y agoThe agile movement is what popularised them, driven by key figures in the Smalltalk and Lisp community, pushing them via Java, Ruby and Python. All of them predating D.