www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Inline D in Javascript

reply =?ISO-8859-1?Q?K=e5re_Andersson?= <kare_andersson yahoo.se> writes:
I read some comment on D on the need for a "killer application" to boost
popularity. 

What about "inline D" in javascript (/php)?

What strikes me is the perfect profile of D. The compiler is fast, and the
resulting code is fast as well. Still, with some few issues (like
documentation), D is relatively easy to learn. The safety is hight, compared
with C++.

I understand that other forces than "how good it is" are of higher importance
for the direction of the development on Internet. For instance, html5 is moving
forward due to its compability with new technology, although much of its
handling of text and graphics are awkward, gaining an edge over java/flash.

Still I believe in reason as part of the development. My own primary interest
is in developing demonstration platforms for simple functions (open source). I
believe there is so much good software out there which is ignored just because
of lack of accessibility. Also D has this problem to some extent, although the
obvious solution is more people getting to use D and taking part in its growth.

Obviously, inline D would need some kind of package to make it. Then if D code
occurs in the JavaScript, it is compiled "just in time" and the machine code
temporarily stored like a (virtual) cookie. The D functions are then called
from the script in analogy to how local server scripts are called and the
result dynamically implemented.

I can see the safety issues, but how about the vision? Is the vision realistic
at all?
Dec 23 2012
next sibling parent Jacob Carlborg <doob me.com> writes:
On 2012-12-23 22:47, KÃ¥re Andersson wrote:
 I read some comment on D on the need for a "killer application" to boost
popularity.

 What about "inline D" in javascript (/php)?
You might want to take a look at this: http://forum.dlang.org/thread/yfmgvgprfpiquakiyjlk forum.dlang.org -- /Jacob Carlborg
Dec 24 2012
prev sibling parent reply =?ISO-8859-1?Q?K=e5re_Andersson?= <kare_andersson yahoo.se> writes:
Jacob Carlborg Wrote:

 On 2012-12-23 22:47, KÃ¥re Andersson wrote:
 I read some comment on D on the need for a "killer application" to boost
popularity.

 What about "inline D" in javascript (/php)?
You might want to take a look at this: http://forum.dlang.org/thread/yfmgvgprfpiquakiyjlk forum.dlang.org -- /Jacob Carlborg
*** Many thanks for the link. Although I found the discussion about "inline D", and many of the idéas there seemed very interesting, I must admit I have some problems to see exactly what it does. But I understand he is on a very interesting track with regard to a lot of the issues on my mind. I will dig into this and see what comes up. sincerely / Kåre
Dec 24 2012
next sibling parent reply maarten van damme <maartenvd1994 gmail.com> writes:
Or, if you really want client side javascript, try mixing emscripten
en ldc. If you want a great server-side library, take a look at adam
rupe's work.
Dec 24 2012
parent =?ISO-8859-1?Q?K=e5re_Andersson?= <kare_andersson yahoo.se> writes:
maarten van damme Wrote:

 Or, if you really want client side javascript, try mixing emscripten
 en ldc. If you want a great server-side library, take a look at adam
 rupe's work.
*** Thankyou - then I probably misunderstood Adam Rupes post. If it takes compiled D and output JavaScript, the tool has other objectives then for demonstration.
Dec 24 2012
prev sibling next sibling parent reply "Adam D. Ruppe" <destructionator gmail.com> writes:
On Monday, 24 December 2012 at 20:09:22 UTC, KÃ¥re Andersson wrote:
 I must admit I have some problems to see exactly what it does.
What it does is take a D file in and spit out a javascript file. There's no speed boost from JS because it IS javascript on the output.
Dec 24 2012
parent reply =?ISO-8859-1?Q?K=e5re_Andersson?= <kare_andersson yahoo.se> writes:
Adam D. Ruppe Wrote:

 On Monday, 24 December 2012 at 20:09:22 UTC, KÃ¥re Andersson wrote:
 I must admit I have some problems to see exactly what it does.
What it does is take a D file in and spit out a javascript file. There's no speed boost from JS because it IS javascript on the output.
*** Such a beautiful idea, and very useful. It looks like mr. Jacob Carlborg went ahead and read my thoughts with that link. Firstly, I have always believed that for instance downloading someting, is an obstacle for someone who just wants to get a first grasp of a new programming language. They want to instantly and online do some tests and get a feeling before downloading something. Secondly, and maybe it is the primary goal, it can be a good development tool, especially for functions, with the capacity of immediate demonstrations. Even a more advanced programmer wants to know exacly what a function/tool does before investing further energy examining it.
Dec 24 2012
parent reply "Marco Nembrini" <marco.nembrini.co gmail.com> writes:
On Tuesday, 25 December 2012 at 07:28:18 UTC, KÃ¥re Andersson 
wrote:


 Firstly, I have always believed that for instance downloading 
 someting, is an obstacle for someone who just wants to get a 
 first grasp of a new programming language. They want to 
 instantly and online do some tests and get a feeling before 
 downloading something.

 Secondly, and maybe it is the primary goal, it can be a good 
 development tool, especially for functions, with the capacity 
 of immediate demonstrations. Even a more advanced programmer 
 wants to know exacly what a function/tool does before investing 
 further energy examining it.
If you want to try out D code without downloading the compiler there's http://dpaste.dzfl.pl/
Dec 25 2012
parent =?ISO-8859-1?Q?K=e5re_Andersson?= <kare_andersson yahoo.se> writes:
Marco Nembrini Wrote:

 On Tuesday, 25 December 2012 at 07:28:18 UTC, KÃ¥re Andersson 
 wrote:
 
 
 Firstly, I have always believed that for instance downloading 
 someting, is an obstacle for someone who just wants to get a 
 first grasp of a new programming language. They want to 
 instantly and online do some tests and get a feeling before 
 downloading something.

 Secondly, and maybe it is the primary goal, it can be a good 
 development tool, especially for functions, with the capacity 
 of immediate demonstrations. Even a more advanced programmer 
 wants to know exacly what a function/tool does before investing 
 further energy examining it.
If you want to try out D code without downloading the compiler there's http://dpaste.dzfl.pl/
*** Thankyou. Saw there were several compilers to choose among also, compared with a site like codepad.org, which is useful.
Dec 25 2012
prev sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2012-12-24 21:09, KÃ¥re Andersson wrote:

     ***
   Many thanks for the link. Although I found the discussion about "inline D",
and many of the id�as there seemed very interesting, I must admit I have some
problems to see exactly what it does. But I understand he is on a very
interesting track with regard to a lot of the issues on my mind. I will dig
into this and see what comes up.

    sincerely / K�re
There's also a project that converts LLVM IR to JavaScript that might be of interest. https://github.com/kripken/emscripten/wiki -- /Jacob Carlborg
Dec 25 2012
parent =?ISO-8859-1?Q?K=e5re_Andersson?= <kare_andersson yahoo.se> writes:
Jacob Carlborg Wrote:

 On 2012-12-24 21:09, KÃ¥re Andersson wrote:
 
     ***
   Many thanks for the link. Although I found the discussion about "inline D",
and many of the id�as there seemed very interesting, I must admit I have some
problems to see exactly what it does. But I understand he is on a very
interesting track with regard to a lot of the issues on my mind. I will dig
into this and see what comes up.

    sincerely / K�re
There's also a project that converts LLVM IR to JavaScript that might be of interest. https://github.com/kripken/emscripten/wiki -- /Jacob Carlborg
*** Very inspiring indeed, also from a demo-perspective. Almost hard to believe JavaScript can be made to do such havy duty stuff. I will se if I am able to add anything of worth to all this activity. First I have to learn D properly. Right now, I have only experience in other computer languages.
Dec 25 2012