The D Scripting Language
sybrandy
sybrandy at gmail.com
Thu Nov 11 09:13:18 PST 2010
> Perhaps a module std.scripting could help quite a lot, too.
>
> Andrei
Also, something I just thought of this morning is to create something
similar to std.variant for variables where every variable is the same
type. Perl, for example, may store the same value multiple times in the
same "structure" (I don't know the right term) depending on if it was
used as a number, a string, or both. This can make language easier to
use for scripting so that the user doesn't have to worry about data types.
For example (Using Foo as the name of the type for lack of a better name):
Foo x = 27;
x += 15; // X is now 42
Foo y = "X is " ~ x; // Here, x is now treated like a string.
The way I figure it, and I could be wrong, this could be stored as a
struct with the various op* operations defined to perform the correct
operation when called. Also, errors should be reported if, for example,
someone tries to add the value "bar" to 13.
I think this would be a good first step to making D more scripting
friendly, though less efficient in terms of memory and speed. And
hopefully this would also work with all of the existing methods that we
have, though there are probably a ton of issues related to that.
Casey
More information about the Digitalmars-d
mailing list