Another "D is cool" post

Guillaume Boucher via Digitalmars-d digitalmars-d at puremagic.com
Mon May 29 12:54:22 PDT 2017


On Monday, 29 May 2017 at 19:07:03 UTC, H. S. Teoh wrote:
> So, recently in one of my pet projects I have a bit of code 
> that takes a string, fills in a code template, invokes the D 
> compiler to create a shared object, then loads the object with 
> dlopen() and calls dlsym() to get the entry point into the 
> compiled code as a function pointer.

Seems like the perfect job for a scripting language like Python.

I'm not sure why you decided to compare everything to C.  Even C 
programmers will agree with you that in D you can do things in a 
shorter way -- just slower/bloated/more magic/with less 
control/not portable/<that C programmers favourite excuse>.

In all the examples you bring, there's nothing special about D.  
You can do anything in C++/Go/Rust/Swift/Python/<any other non-C 
language> with comparable complexity.

> The tricky part, though, is that .mangleof only works on an 
> identifier defined in the *current* program; the compiler can't 
> do it for a symbol in a string that's to be passed at runtime 
> to another invocation of the compiler.  And AFAIK, there's 
> currently no way to ask the compiler "what would be the 
> mangling of mymodule.symbol?" if 'mymodule' and 'symbol' only 
> exist in the shared object, not in the main program.

Not a problem in any other language (C++ has a well-defined ABI, 
dynamic languages don't need that).

I enjoy D, but some of those fanboy posts are just totally 
worthless.


More information about the Digitalmars-d mailing list