bearophile wrote:
Andrei Alexandrescu:
Yes. The amount of confusion in this thread is staggering.

I think I have misunderstood about the whole thread then. If the string isn't 
determined at run time, then this thing isn't useful for my purposes, and it's 
not close to the object-C as I was talking about, and it's not similar to 
__getattr__ of Python, etc.

Bye,
bearophile

There are two issues here:
- The ability to invoke a method where you did not explicitly create a method with that name. - A standardized way of looking up a method to invoke based on a string, where that string may be created at runtime. You can already do this, but there's no standard interface for it. If there were an interface somewhere, like IDispatch { Variant invoke(string, ...); }, that would be nice. Though it doesn't work with structs.

In the former case, the method will not exist unless you call it -- for example, swizzling. This is powerful; it means you can use templates to generate the function body.

The latter case doesn't give you very much. I'd like to see it in the standard library, but it wouldn't be called before issuing a MethodMissingException or the like because it isn't applicable.

Reply via email to