On Friday, 2 June 2017 at 02:15:27 UTC, Adam D. Ruppe wrote:
On Friday, 2 June 2017 at 02:06:27 UTC, Mike B Johnson wrote:
I wonder if it is possible to somehow turn D in to a scripting language that can be run inside D?

Why not just use regular compiled D?


Because it requires one to recompile and relink the code for every change(and to possibly restart the app and redo all the work to get to some point to start testing the code). In a scripting engine one can simply call a function and execute commands immediately in an interactive way. This allows for much faster testing.


e.g., with a hypothetical app that has an interactive Dscript, one could do

App.PlaySound("test123.wav");


instead of

1. change test12.wav to test123.wav
2. save file
3. recompile.
4. run
5. Get back to same test point(could be a lot or a little amount of work).


Regardless, that is not the point though. If that was the only reason, lua or some other scripting language would suffice.

The problem is that the grammars of all those languages do not translate directly in to D. Anglescript is a C++ like script that has a near 1-1 correspondence so "porting" code from it to C++ is easy.

But it would be nice if a D had a scripting language that used the same D syntax as this would make porting a piece of cake.


The point is, why should I develop, say, 100's of algorithms in the scripting language that can never easily be ported to native and be fast as possible simply because the of the amount of work to rewrite the code when, semantically, nothing changes?

Wouldn't it be much better to be able to confidently write the code in a scripting environment that allows for nearly instance response knowing that it can simply be recompiled to native without issue when the time comes for performance optimizations?

Anglescript effectively does this. Note only does it have a C++ like syntax, it has the ability to compile to native directly with an addon.

I'm looking for something like this in D because D's features are much better. having meta capabilities in scripting would be cool.





Reply via email to