Are there any D scripting engines for use with D?

cym13 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jan 4 11:01:05 PST 2016


On Monday, 4 January 2016 at 18:40:03 UTC, Jason Jeffory wrote:
> We have many scripting engines available for use in D more or 
> less(lua, python, etc...).
>
> Is there a D scripting engine that can be easily integrated 
> into a D project? A sort of "exec(<dcode>)". Something that 
> works at compile time and run time possibly? If <dcode> is a 
> static string then it should be able to compile it at compile 
> time, else, run time. Also, it would be nice if one could set 
> up a unique state for the code to run in(so it can't be hacked 
> by harmful coding), e.g., "exec(<dcode>, state)", where state 
> is the state used for the exec(passed along to the <dcode> to 
> use) for external function access and variable passing.
>
> Something that is fast as possible would be nice too! I know 
> there this is quite a request, but hopefully there will be work 
> on it. I'd love to see scripting capabilities included with 
> most programs! This would be a start, at least, for my programs.

Lua and python are already covered ([1] and [2]), for the D code 
I don't think so. While you can always call rdmd from D to 
compile and execute something in a script-like fashion it may not 
provide the level of integration you are looking for. On the 
other hand you should have a look at Adam Ruppe's script language 
that is written in D, largely benefits from CTFE but can be used 
at runtime too and has a JS-like syntax achieved by simply 
defining new D types (IIUC). That way you get a well-integrated 
easy to use language (although not quite polished). [3]

[1]: http://code.dlang.org/packages/luad
[2]: http://code.dlang.org/packages/pyd
[3]: 
http://forum.dlang.org/thread/kuxfkakrgjaofkrdvgmx@forum.dlang.org


More information about the Digitalmars-d-learn mailing list