digitalmars.D - Advertise D's great compatibilty with JavaScript
- Ecstatic Coder (30/30) Jun 18 2017 Something I really appreciate a lot with D is how close it is to
- Joakim (4/7) Jun 18 2017 Talk to Mike Parker about submitting a blog post, detailing the
- Ecstatic Coder (3/11) Jun 18 2017 Indeed the following introduction page is missing :
- Meta (6/37) Jun 18 2017 We should be careful not to make *too* close a comparison. While
- rikki cattermole (5/10) Jun 18 2017 The moment webasm becomes a realistic target, I will do EVERYTHING in my...
- Laeeth Isharc (4/16) Jun 18 2017 Why not D? And why wait till it's a realistic target? Wasm is
- rikki cattermole (3/20) Jun 18 2017 (1) eval
- John Gabriele (5/28) Oct 13 2017 Why do you choose Lua? Whatever replaces Javascript (and compiles
- Marco Leise (10/14) Oct 14 2017 I agree with that. Whenever the time comes to make adjustments
- Ecstatic Coder (21/39) Oct 14 2017 +1
- JN (4/7) Jun 18 2017 I don't think that's a good selling point. The obvious reply is
- Joakim (13/21) Jun 18 2017 Speed, you're limited by the browser but not on the server. I'm
- Sebastiaan Koppe (5/7) Jun 18 2017 Although there are proposals to access the dom directly from
- Ecstatic Coder (21/27) Jun 18 2017 Ok, I could agree with you.
- Steven Schveighoffer (4/7) Jun 18 2017 This was a good talk last year you might be interested in:
- Ecstatic Coder (8/11) Jun 18 2017 Nice pick :)
- Adam D. Ruppe (3/5) Jun 18 2017 Have you ever seen my jsvar.d ?
- Ecstatic Coder (1/3) Jun 19 2017 AWESOME !!!
- Ecstatic Coder (12/43) Oct 12 2017 Not directly related to my post, but in the unlikely event that
- Ecstatic Coder (10/10) Oct 13 2017 As just requested by a user, I've put the image size on the
- Walter Bright (3/4) Oct 14 2017 There's also a D implementation of Javascript:
- Dmitry Olshansky (7/12) Oct 14 2017 The surprising strength of DMDScript is that it uses the same GC
- Walter Bright (3/15) Oct 14 2017 I always thought DMDScript would be a great plugin extension language to...
- Ecstatic Coder (9/14) Oct 14 2017 What about a DScript interpreter ?
- Walter Bright (3/12) Oct 14 2017 That could be done, but for small plugins a small dynamic language can b...
- Joakim (4/21) Oct 14 2017 Something like this?
- Ecstatic Coder (3/29) Oct 14 2017 Not exactly the LLVM-based compile-to-memory interpreter I was
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.
Jun 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.
Jun 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:Indeed the following introduction page is missing : https://dlang.org/jstod.htmlSomething 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.
Jun 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.
Jun 18 2017
On 18/06/2017 5:29 PM, Meta wrote: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.The moment webasm becomes a realistic target, I will do EVERYTHING in my power to get Lua in the browser (yes there already is solutions). Stuff Javascript, kill it, replace it with something actually properly designed!
Jun 18 2017
On Sunday, 18 June 2017 at 23:11:25 UTC, rikki cattermole wrote:On 18/06/2017 5:29 PM, Meta wrote:Why not D? And why wait till it's a realistic target? Wasm is clearly going to be the answer and it's an answer to a problem that exists, so what does one gain by waiting?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.The moment webasm becomes a realistic target, I will do EVERYTHING in my power to get Lua in the browser (yes there already is solutions). Stuff Javascript, kill it, replace it with something actually properly designed!
Jun 18 2017
On 19/06/2017 2:57 AM, Laeeth Isharc wrote:On Sunday, 18 June 2017 at 23:11:25 UTC, rikki cattermole wrote:(1) eval (2) time+not all API's required are available just yet.On 18/06/2017 5:29 PM, Meta wrote:Why not D? And why wait till it's a realistic target? Wasm is clearly going to be the answer and it's an answer to a problem that exists, so what does one gain by waiting?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.The moment webasm becomes a realistic target, I will do EVERYTHING in my power to get Lua in the browser (yes there already is solutions). Stuff Javascript, kill it, replace it with something actually properly designed!
Jun 18 2017
On Monday, 19 June 2017 at 02:02:05 UTC, rikki cattermole wrote:On 19/06/2017 2:57 AM, Laeeth Isharc wrote:Why do you choose Lua? Whatever replaces Javascript (and compiles to wasm) will be used for large apps, like how Javascript is currently used. My understanding is that Lua is not particularly well suited for building large apps.On Sunday, 18 June 2017 at 23:11:25 UTC, rikki cattermole wrote:(1) eval (2) time+not all API's required are available just yet.On 18/06/2017 5:29 PM, Meta wrote:Why not D? And why wait till it's a realistic target? Wasm is clearly going to be the answer and it's an answer to a problem that exists, so what does one gain by waiting?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.The moment webasm becomes a realistic target, I will do EVERYTHING in my power to get Lua in the browser (yes there already is solutions). Stuff Javascript, kill it, replace it with something actually properly designed!
Oct 13 2017
Am Fri, 13 Oct 2017 17:57:12 +0000 schrieb John Gabriele <jgabriele fastmail.fm>:Why do you choose Lua? Whatever replaces Javascript (and compiles to wasm) will be used for large apps, like how Javascript is currently used. My understanding is that Lua is not particularly well suited for building large apps.I agree with that. Whenever the time comes to make adjustments to the Lua code I miss the good old "compiler will tell me where type became incompatible" style of refactoring. As common in scripting languages nothing stops you from having typos in a property name that you want to assign a new value. It'll just create a new one. -- Marco
Oct 14 2017
On Monday, 19 June 2017 at 01:57:00 UTC, Laeeth Isharc wrote:On Sunday, 18 June 2017 at 23:11:25 UTC, rikki cattermole wrote:+1 At the moment, for web development I use Go or PHP on the server side, and JavaScript on the client side. Using Node.js on the server side would allow me to use the same language on both side, which would be PERFECT. But programming asynchronous code with Node.js is a pain in the ass compared to Go. D's syntax and standard libraries make it very similar to both JavaScript and Go. I know it because it was incredibly easy to convert my Node.js tools to D. With Wasm, D has the potential to become a perfect alternative to Dart and JavaScript, by being available on both the server and the client side. This is a unique window of opportunity for D, as this would make it a very solid and serious contender to both Dart, Go, JavaScript and C++. So why not try to promote the development of a D to Wasm compiler as a master thesis to the software engineering students in universities ?On 18/06/2017 5:29 PM, Meta wrote:Why not D? And why wait till it's a realistic target? Wasm is clearly going to be the answer and it's an answer to a problem that exists, so what does one gain by waiting?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.The moment webasm becomes a realistic target, I will do EVERYTHING in my power to get Lua in the browser (yes there already is solutions). Stuff Javascript, kill it, replace it with something actually properly designed!
Oct 14 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?".
Jun 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: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. ;)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?".
Jun 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
Jun 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...
Jun 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
Jun 18 2017
This was a good talk last year you might be interested in: http://dconf.org/2016/talks/schadek.html -SteveNice 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...
Jun 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.Have you ever seen my jsvar.d ? http://forum.dlang.org/thread/kuxfkakrgjaofkrdvgmx forum.dlang.org
Jun 18 2017
Have you ever seen my jsvar.d ? http://forum.dlang.org/thread/kuxfkakrgjaofkrdvgmx forum.dlang.orgAWESOME !!!
Jun 19 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.Not directly related to my post, but in the unlikely event that somebody on this forum has started to use Pendown, I must inform you that I've slightly changed the list and image syntaxes to make the even more practical. I always do my best to avoid making breaking changes in my open source tools, but as this project has zero stars on Github, I thought I could freely fix the syntax, as this generally implies that people have no interest in using it. And if I was wrong, that's really easy to fix the existing documents anyway, by making just a few find'n'replace in any plain text editor...
Oct 12 2017
As just requested by a user, I've put the image size on the right. Nice remark, this indeed improves their readability. The image syntax will now be frozen this way : [[image_name.jpg:size]]. To update the existing files, just open them all in Geany, and replace the regular expression "\[\[(.+?):(.+?)\]\]" by "\1\1* " to fix the old lists. Many thanks for this positive feedback from the D community, that was really appreciated :D
Oct 13 2017
On 6/18/2017 3:38 AM, Ecstatic Coder wrote:Something I really appreciate a lot with D is how close it is to JavaScript.There's also a D implementation of Javascript: https://github.com/DigitalMars/DMDScript
Oct 14 2017
On Saturday, 14 October 2017 at 07:45:06 UTC, Walter Bright wrote:On 6/18/2017 3:38 AM, Ecstatic Coder wrote:The surprising strength of DMDScript is that it uses the same GC as D does, making sharing of objects between JS and Host transparent and 0-copy. A typical JS engine run internal GC which the host has to interact with in cumbersome ways b/c it doesn’t know about hosts’s memory.Something I really appreciate a lot with D is how close it is to JavaScript.There's also a D implementation of Javascript: https://github.com/DigitalMars/DMDScript
Oct 14 2017
On 10/14/2017 12:54 AM, Dmitry Olshansky wrote:On Saturday, 14 October 2017 at 07:45:06 UTC, Walter Bright wrote:I always thought DMDScript would be a great plugin extension language to use in a D IDE.On 6/18/2017 3:38 AM, Ecstatic Coder wrote:The surprising strength of DMDScript is that it uses the same GC as D does, making sharing of objects between JS and Host transparent and 0-copy. A typical JS engine run internal GC which the host has to interact with in cumbersome ways b/c it doesn’t know about hosts’s memory.Something I really appreciate a lot with D is how close it is to JavaScript.There's also a D implementation of Javascript: https://github.com/DigitalMars/DMDScript
Oct 14 2017
On Saturday, 14 October 2017 at 07:45:06 UTC, Walter Bright wrote:On 6/18/2017 3:38 AM, Ecstatic Coder wrote:What about a DScript interpreter ? I mean an interactive D code compiler, which compiles D code on the fly and runs it directly within an application, like the eval() function of JavaScript. Something that works at least for some D subset. For C++, there is the Cling interactive interpreter, based on LLVM : https://github.com/vgvassilev/clingSomething I really appreciate a lot with D is how close it is to JavaScript.There's also a D implementation of Javascript: https://github.com/DigitalMars/DMDScript
Oct 14 2017
On 10/14/2017 1:52 AM, Ecstatic Coder wrote:On Saturday, 14 October 2017 at 07:45:06 UTC, Walter Bright wrote:That could be done, but for small plugins a small dynamic language can be more convenient.On 6/18/2017 3:38 AM, Ecstatic Coder wrote:What about a DScript interpreter ?Something I really appreciate a lot with D is how close it is to JavaScript.There's also a D implementation of Javascript: https://github.com/DigitalMars/DMDScript
Oct 14 2017
On Saturday, 14 October 2017 at 08:52:54 UTC, Ecstatic Coder wrote:On Saturday, 14 October 2017 at 07:45:06 UTC, Walter Bright wrote:Something like this? https://github.com/dlang-community/dreplOn 6/18/2017 3:38 AM, Ecstatic Coder wrote:What about a DScript interpreter ? I mean an interactive D code compiler, which compiles D code on the fly and runs it directly within an application, like the eval() function of JavaScript. Something that works at least for some D subset. For C++, there is the Cling interactive interpreter, based on LLVM : https://github.com/vgvassilev/clingSomething I really appreciate a lot with D is how close it is to JavaScript.There's also a D implementation of Javascript: https://github.com/DigitalMars/DMDScript
Oct 14 2017
On Saturday, 14 October 2017 at 10:48:40 UTC, Joakim wrote:On Saturday, 14 October 2017 at 08:52:54 UTC, Ecstatic Coder wrote:Not exactly the LLVM-based compile-to-memory interpreter I was thinking about, but this could indeed do the job ;)On Saturday, 14 October 2017 at 07:45:06 UTC, Walter Bright wrote:Something like this? https://github.com/dlang-community/dreplOn 6/18/2017 3:38 AM, Ecstatic Coder wrote:What about a DScript interpreter ? I mean an interactive D code compiler, which compiles D code on the fly and runs it directly within an application, like the eval() function of JavaScript. Something that works at least for some D subset. For C++, there is the Cling interactive interpreter, based on LLVM : https://github.com/vgvassilev/clingSomething I really appreciate a lot with D is how close it is to JavaScript.There's also a D implementation of Javascript: https://github.com/DigitalMars/DMDScript
Oct 14 2017