DMDScript now under Boost license

Robert Clipsham robert at octarineparrot.com
Mon Mar 29 10:49:35 PDT 2010


On 29/03/10 18:41, Adam Ruppe wrote:
> I think it would be pretty great if you could add functions, etc., to
> the scripting language with a simple one liner:
>
> mixin makeAccessibleFromScript!(scriptEngine, foo);

You can do with with MiniD, LuaD, PyD, Monster, and possibly others to 
allow you to script in minid, lua, python an monster (I think there's 
something for ruby out there too). I haven't played with dmdscript, but 
I'd guess there's a simple way to expose D functions to it.

> Or something similar. The template there could mix in a wrapper
> function for whatever foo() happens to be, and register it with the
> scripting engine all in one call.
>
> Then, to call a function defined in script, you should be able to just
> do callScriptFunction("name", args...);, but this is optional; I say
> getting D functions accessible from the script with ease is more
> important.

All of the above languages/wrappers have some way of doing this, with 
various degrees of simplicity/ease.

> Anyway, you take that and the dmdscript and package them together as
> an D extender library. To use it, you just import the script module,
> mixin the template to extend it, and boom, done.

I don't think this is a good idea, unless a decent policy for what is 
included can be figured out. That said, I believe there's an old version 
of dmd packaged with projects that work with it.

> Perhaps down the line, a magic function could even look for
> @scriptable attributes* and add them automatically. But no need
> immediately.
>
> * I'll say again, I'd love to have user defined attributes accessible
> from __traits for just this kind of thing.

I'm pretty sure user defined attributes aren't in for D2, it looks like 
it'll be D3 or later if/when we get them.


More information about the Digitalmars-d-announce mailing list