Walter Bright wrote:
Simen kjaeraas wrote:
I'm already in love with this feature.

So am I. It seems to be incredibly powerful.

Looks to me you can do things like:

1. hook up to COM's IDispatch

2. create 'classes' at runtime

3. add methods to existing classes (monkey patching) that allow such extensions

4. provide an easy way for users to add plugins to an app

5. the already mentioned "swizzler" functions that are generated at runtime based on the name of the function

Can you show examples of points 2, 3 and 4?

I can't see antyhing "dynamic" in this feature. I can't invoke an object's method based on it's name:

class Foo {

  void opDispatch(string name)() { ... }

}

Foo foo = new Foo();

string something = get_user_input();
foo.opDispatch!(something)(); // no, can't do it
foo.something(); // not the same...

So where's the magic? I think opDispatch is just another metaprogramming feature, nothing else.

Reply via email to