dynamic classes and duck typing
bearophile
bearophileHUGS at lycos.com
Sat Nov 28 06:00:35 PST 2009
Walter Bright:
> and then s.foo(3), if foo is not a compile time member of s, is
> rewritten as:
> s.opDynamic!("foo")(3);
I don't understand, isn't this the right translation?
s.opDynamic("foo", 3);
If the "foo" name is known at compile time only (as in all C# examples and in Python) you can't use a template argument.
(And then it becomes useful to have associative arrays that are fast when the number of keys is small, < 10).
Bye,
bearophile
More information about the Digitalmars-d
mailing list