On 2012-09-04 21:39, Adam D. Ruppe wrote:
On Tuesday, 4 September 2012 at 19:18:05 UTC, Jacob Carlborg wrote:
I've also wished quite many times I had dynamic typing in D.
I think we're *fairly* close with things like std.variant,
especially combined with some helpers. Take a look:
Variant a = 10;
string b = a; // can't, and I say that's good, usually
b = a.coerce!string; // works
But, to get a dynamic feel, you don't want to write
out coerce!type. I kinda want it to be auto. So,
Variant a = 10;
string b;
b.dset = a; // dset means dynamic set
This is pretty doable in D today.
When I said "dynamic typing" that was a bit misleading. It's more the
dynamic nature of Ruby I like. For example:
* Open classes
* Reflection - adding methods, calling a method via a string, introspection
* Have executing code in all level of scopes
* Eval
The comparable features in a static language would probably AST-macros,
annotations and similar features. If D had those features then I
probably wouldn't want dynamic typing that much.
--
/Jacob Carlborg