On Sunday, 18 June 2017 at 10:38:49 UTC, Ecstatic Coder wrote:
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.

We should be careful not to make *too* close a comparison. While Javascript is a necessary evil for web applications and some people do like it, I get the feeling that it's becoming less and less liked. It's not quite a fractal of bad design like PHP, but it has more than a few drastic shortcomings and design flaws.

Reply via email to