www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - javascript or typescript

reply Fred <xmen.cecep yahoo.com> writes:
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.
Nov 04 2018
next sibling parent reply Adam D. Ruppe <destructionator gmail.com> writes:
On Monday, 5 November 2018 at 02:51:19 UTC, Fred wrote:
 i'd like to give d a try.
Why do you need to convert it to javascript? D can serve up web stuff by itself too.
Nov 04 2018
parent Fred <xmen.cecep yahoo.com> writes:
On Monday, 5 November 2018 at 05:07:49 UTC, Adam D. Ruppe wrote:
 On Monday, 5 November 2018 at 02:51:19 UTC, Fred wrote:
 i'd like to give d a try.
Why do you need to convert it to javascript? D can serve up web stuff by itself too.
did you mean vibe.d? but i want to use in a shared hosting environment where my options are : ruby, python, nodejs and as usual php vibe.d as standalone app will not work. i know kotlin with js support, but maybe there is another option .. thanks for your answer and insight.
Nov 05 2018
prev sibling next sibling parent reply Laurent =?UTF-8?B?VHLDqWd1aWVy?= <laurent.treguier.sink gmail.com> writes:
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.
I haven't personally tried it, but there is an example of compiling D to Javascript here : https://github.com/Ace17/dscripten
Nov 05 2018
next sibling parent Fred <xmen.cecep yahoo.com> writes:
On Monday, 5 November 2018 at 08:49:42 UTC, Laurent Tréguier 
wrote:
 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.
I haven't personally tried it, but there is an example of compiling D to Javascript here : https://github.com/Ace17/dscripten
ok will look at it. thanks.
Nov 05 2018
prev sibling parent Dukc <ajieskola gmail.com> writes:
On Monday, 5 November 2018 at 08:49:42 UTC, Laurent Tréguier 
wrote:
 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.
I haven't personally tried it, but there is an example of compiling D to Javascript here : https://github.com/Ace17/dscripten
The example I used (thanks to Cosinuns): https://github.com/cosinus2/dlang-emscripten-demo I'd try DScripten first, though. Without, I need to compile parts of Phobos myself to JS. Plus the Emscripten linker seemingly can't link D symbols because of some bug. I have to manually call the LLVM linker, which sometimes seems to have different ideas about what the program is calling.
Nov 05 2018
prev sibling parent Dukc <ajieskola gmail.com> writes:
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/ 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.
Nov 05 2018