javascript or typescript

Dukc ajieskola at gmail.com
Mon Nov 5 11:13:14 UTC 2018


On Monday, 5 November 2018 at 02:51:19 UTC, Fred wrote:
> hi,
> my javascript skill is bad.
> but i want to host some nodejs app
>
> i am aware that there is converter to js like dtojs. but it is 
> out of date.
>
> i'd like to give d a try. is there any other converter 
> available. a decent one.

Let me recommend https://bridge.net/

Transpiles C# to JavaScript. I use it at work as my main tool. 
Feels very mature. IMO C# < D, but it still wipes the floor with 
using JavaScript directly.

Minority of my JavaScript is also transpiled from D. If you do 
the same, you will need a lot more determination and know-how 
than normal, and you can't except to use all D features. 
Multithearding and GC among other features are out.

You could use DScripten which will probably make D better in this 
regard, but still not like normal. Personally I haven't still 
tried DScripten because there is not much I could easily port to 
D.

The reason for that is that D cannot call most js functions 
directly, because it cannot handle most JavaScript types. Except 
if you manage to translate Emscripten headers val.h and wire.h 
(which are heavily templated c++) into D. I have put some effort 
to that, but it's not going well.

Because of the reasoms above, I don't currently recommend D as a 
JavaScript source for the average programmer. However, you will 
most likely want to make some utility programs to assist you 
-build scripts, mass file handling, translating configuration 
file formats etc. There D works very well.

Also, as said, the server backend does not have to be JavaScript 
- only the frontend. For backend, you can use D web frameworks 
-vibe.d/hunt/diamond- instead.


More information about the Digitalmars-d-learn mailing list