Advertise D's great compatibilty with JavaScript

Ecstatic Coder via Digitalmars-d digitalmars-d at puremagic.com
Sun Jun 18 03:38:49 PDT 2017


Something I really appreciate a lot with D is how close it is to 
JavaScript.

For instance, I have to maintain two similar versions of Pendown, 
a Markdown alternative for colored documents.

There is a server-side version, in D :

     https://github.com/senselogic/PENDOWN/blob/master/pendown.d

And a client-side version, in JavaScript :

     https://github.com/senselogic/PENDOWN/blob/master/pendown.js

If you look at both file, you should see how close both files are.

Thanks to a few methods (charAt, slice, push, pop, etc) added to 
the string and array types, when I change a function 
implementation in one version, all I have to do is copy-paste the 
modifications in the other file and just make a few minor changes 
(==/===, ~/+, etc).

Everything else works unchanged : string and array methods 
(length, split, join, startsWith, endsWith), closures, etc.

I think that's really AWESOME to have designed the D language and 
its standard library in such a way, keeping it so close to 
JavaScript, the most used scripting languages on earth !!!

That's why I personally advertise it like a "strongly-typed 
super-powered JavaScript", as it is the best scripting language I 
know.

Even if D is obviously much more than that, this still accurately 
describes what many programmers should feel when using this 
fantastic language.

Therefore I think that this closeness is something that should be 
advertised much more, so that people know that :
- a JavaScript programmer will immediately feel at home with D;
- porting text manipulation code back and forth between D and 
JavaScript is just a breeze.



More information about the Digitalmars-d mailing list