Make D a dynamic language.
Christopher Wright
dhasenan at gmail.com
Tue Feb 5 05:45:41 PST 2008
sclytrack wrote:
> Make D a dynamic language.
>
> struct, class, dynamic.
>
> Introduce a dynamic type in D. Where you can add methods to it at runtime.
> Speed should be less of an issue. Provide a simple syntax in D to make the
> method calls.
>
> var obj = new CustomDynamicObject();
>
> obj.doStuff();
> //not checked at compile time since it is dynamic. doStuff might not exist,
> but it still compiles.
>
> obj[x] = 10; //Support for the usual syntax.
>
>
> /me hides
No.
You could do something similar, but using strings and it'd be a lot more
obvious what you were doing. Make a method that accepts a string and
varargs and dispatches to a stored delegate based on the args. The
stored delegates would have to be generated at compile time, of course.
Ugly, but it works. Or just use MiniD.
More information about the Digitalmars-d
mailing list