4 ms·
Articles like this I guess. If these are the 'lovable' features I'd hate to see the 'meh' features. Automatic constructors - You only have to write the 'make
by mrkeen 1y ago
Articles like this I guess. If these are the 'lovable' features I'd hate to see the 'meh' features.
Automatic constructors - You only have to write the 'make me a box of two apples' code and not 'this is how two apples go into a box'! This is as revolutionary as 'automatic function calls', where you don't have to manually push the instruction pointer to pop it back off later.
Parenthesis omission!
If I were to parody this I'd talk about how good Scala is - in addition to classes, you can also declare objects, saving you the effort of typing out the static keyword on each member.
Sell me something nice! Millions of threads on a node. Structured concurrency. Hygienic macros. Homoiconicity. Higher-kinded types. Decent type inference. Pure functions. Transactions.
- WalterBright 1y agoD has pure functions: https://dlang.org/spec/function.html#pure-functions https://dlang.org/spec/function.html#pure-functions D's pure functions are quite strict. It can be a challenge to write a function that passes strict purity guarantees - but the result is worth it!
- zem 1y agocompile time function evaluation is "nice" in the same way those features are, isn't it?
- WalterBright 1y agoWhat's interesting is that other languages have since adopted CTFE, but they missed the point and did it wrong. The usual mistake is to add a keyword necessary to trigger it. D triggers it when an expression appears where a "const-expression" appears in the grammar. I.e: int x = f(); // f() is run at run time enum y = f(); // f() is run at compile time