dynamic classes and duck typing

Bill Baxter wbaxter at gmail.com
Mon Nov 30 16:09:25 PST 2009


On Mon, Nov 30, 2009 at 3:38 PM, bearophile <bearophileHUGS at lycos.com> wrote:
> Walter Bright:
>> So am I. It seems to be incredibly powerful.
>
> Very powerful things can be dangerous too, they can lead to bugs, etc.

I'm a bit concerned about what this does to introspection.
With a dynamic language like Python, adding runtime methods does not
interfere with your ability to enumerate all the methods supported by
an object.
With this opDispatch it's no longer possible for the compiler to know
what list of methods a class responds to.

So unless we add some way for a class to enumerate such things,
opDispatch effectively kills any introspecting that requires knowing
everything in a class.

So that would make things like automatic wrapper generation difficult.
 And automatic mock classes.  Anything else that requires enumerating
methods?

Also how does this interact with property syntax?

--bb



More information about the Digitalmars-d mailing list