* _D_ \- concurrency uses kernel threads or longjmp, with little language 
support for async semantics
  * _Nim_ \- has await. Rewrites procedures to be async friendly. Futures that 
don't rely on kernel threads.



That's basically the biggest factor in my mind for using Nim. Everything I can 
do in D, I can pretty much do in C, but async futures are not something I can 
do in C. The strategy in D is to make asynchronicity based on kernel threads, 
which while fine in theory, doesn't really perform well in IO bound 
applications, and actually comes with some serious problems since you can't 
make provable assertions about which thread will run when. Deadlocks, 
undetectable memory leaks, and all because nobody ever bothered to use D's 
powerful macro language to implement async/await. They have longjmp based 
fibers, but they're pretty rudimentary, with no futures, or CPS rewriting or 
anything.

Though longjmp based fibers take a lot of memory, they are relatively fast and 
deterministic, so await style procedure rewriting isn't strictly necessary. And 
if you can prove it doesn't _matter_ when each thread is executing, you can 
make strong assertions about your algorithm, so threaded concurrency _can_ work 
in theory. So it might be nitpicking to criticize D there. The languages are 
pretty close in all the other aspects though, and I run into async/await 
situations a _lot_. So, that 's why I've been using Nim lately.

Honestly I _love_ D's syntax to bits. I can't expect a human to be able to 
understand a language that a code editor cannot logically comprehend enough to 
auto-indent, so whitespace indented languages like Nim make me a little leery. 
Also D has those token strings, which aren't precisely hygenic macros, but are 
pretty easy for a code highlighter to parse. Oh, and Nim's grammar is poorly 
defined. You'll see terms in the grammar like "typeDescK" which you have to 
sort of psychically guess the meaning of, since the grammar just never defines 
it. So D wins in terms of syntax, but... I need my async/await.

D's old so it's got a lot of cruft, for what that's worth. (They had to deal 
with the (ugh) wide character fad.)

Reply via email to