Jump to page: 1 2 3
Thread overview
Advertise D's great compatibilty with JavaScript
Jun 18, 2017
Ecstatic Coder
Jun 18, 2017
Joakim
Jun 18, 2017
Ecstatic Coder
Jun 18, 2017
Meta
Jun 18, 2017
rikki cattermole
Jun 19, 2017
Laeeth Isharc
Jun 19, 2017
rikki cattermole
Oct 13, 2017
John Gabriele
Oct 14, 2017
Marco Leise
Oct 14, 2017
Ecstatic Coder
Jun 18, 2017
JN
Jun 18, 2017
Joakim
Jun 18, 2017
Sebastiaan Koppe
Jun 18, 2017
Ecstatic Coder
Jun 18, 2017
Ecstatic Coder
Jun 18, 2017
Adam D. Ruppe
Jun 19, 2017
Ecstatic Coder
Oct 12, 2017
Ecstatic Coder
Oct 13, 2017
Ecstatic Coder
Oct 14, 2017
Walter Bright
Oct 14, 2017
Dmitry Olshansky
Oct 14, 2017
Walter Bright
Oct 14, 2017
Ecstatic Coder
Oct 14, 2017
Walter Bright
Oct 14, 2017
Joakim
Oct 14, 2017
Ecstatic Coder
June 18, 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.

June 18, 2017
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.
>
> [...]

Talk to Mike Parker about submitting a blog post, detailing the similarities you see and using this example, for the official D blog.
June 18, 2017
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.
June 18, 2017
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.
>
> [...]

I don't think that's a good selling point. The obvious reply is "but why should I use an unknown language like D if I could just use node.js and share the client and server code?".
June 18, 2017
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.
>
> [...]

This was a good talk last year you might be interested in: http://dconf.org/2016/talks/schadek.html

-Steve
June 18, 2017
On Sunday, 18 June 2017 at 16:31:28 UTC, JN wrote:
> 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.
>>
>> [...]
>
> I don't think that's a good selling point. The obvious reply is "but why should I use an unknown language like D if I could just use node.js and share the client and server code?".

Speed, you're limited by the browser but not on the server.  I'm running this regex benchmark right now and the D version beats the top C and Rust ones from this list on linux/x64 with a single core:

http://benchmarksgame.alioth.debian.org/u64q/regexredux.html

I need to parallelize the D version and compare with multi-core also.  Of course, once webasm takes off, everyone will simply compile their server code to webasm and ditch javascript altogether:

https://blog.figma.com/webassembly-cut-figmas-load-time-by-3x-76f3f2395164

But then, we can sell those javascript programmers on moving to D. ;)
June 18, 2017
On Sunday, 18 June 2017 at 18:06:50 UTC, Joakim wrote:
> Of course, once webasm takes off, everyone will simply compile their server code to webasm and ditch javascript altogether.

Although there are proposals to access the dom directly from webasm [1], right now you'll still need js. And I doubt it will change anytime soon. Once it does though -> game-changer.

[1]: https://github.com/WebAssembly/design/blob/master/GC.md
June 18, 2017
> I don't think that's a good selling point. The obvious reply is "but why should I use an unknown language like D if I could just use node.js and share the client and server code?".

> I don't think that's a good selling point. The obvious reply is "but why should I use an unknown language like D if I could just use node.js and share the client and server code?".

Ok, I could agree with you.

For instance using the same JavaScript code for the server-side version of Pendown would avoid me the dual maintenance.

But the D version runs so much faster !!!

And I also agree that some people, including me, liked the expressiveness of JavaScript and Node.js, but not its MANY design and implementation flaws !!!

This is why I've actually converted ALL my old node.js command line tools to D over the last few months.

My github repo is full of them...

Because D really "feels" like JavaScript, it was very easy to convert all my Node.js scripts to D.

And the resulting tools are all better than before, because D is both JavaScript and C++ done right, fixing all their major flaws in the same time.

That's why I always say that D feels like a "strongly-typed super-powered JavaScript".

It's clearly a SUPERIOR and BETTER alternative to JavaScript to implement text manipulation tools.

And btw I'm still waiting to find something I really dislike in D...

June 18, 2017
On Sunday, 18 June 2017 at 16:25:06 UTC, Joakim wrote:
> 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.
>>
>> [...]
>
> Talk to Mike Parker about submitting a blog post, detailing the similarities you see and using this example, for the official D blog.

Indeed the following introduction page is missing :

https://dlang.org/jstod.html
June 18, 2017
> This was a good talk last year you might be interested in: http://dconf.org/2016/talks/schadek.html
>
> -Steve

Nice pick :)

I'm currently planning to use D instead of Go for web development, so I may try such an approach, if I somehow manage to understand how to reproduce it :)

At the moment I still use a command-line tool (Basil) to generate the Go structs matching the db design.

Very silly, I know, but that was the simplest way I could find to easily keep them in sync...


« First   ‹ Prev
1 2 3