"Mark J. Reed" wrote:

> But you're opening a big can of worms if you make such a
> change.  The biggest impact would be in the way methods are defined.
> Instead of just being members of a package, they would have to be
> associated with particular objects (classes or instances).  A method
> may still be associated with a class by being defined in its
> package, but what about an instance?    Do we give each
> instance a package?

Rather, How Do We Do This With Vtables?

I've been saying all along that I think class method names should get
a number the first time they appear, which is the offset into the
vtable (array of coderefs) for that name.  That would turn the multiple
hash lookup of current perl method binding into a single array lookup.

So every class has a vtable, which is a copy of its parents except for
what is overridden within it, and a instance that wishes to deviate could
make a local copy of its vtable and twiddle it.

The putative problem is, the vtables might become large.  This could be
solved by having multiple binding methods, and some expressed preference
or heuristic control over which method to use, falling all the way back to
perl5 multiple hash lookups, with the Conway-style Every Instance Gets Its
Own Class syntax becoming compiled into multiple vtables or not.




-- 
                                           David Nicol 816.235.1187
                   ftp://ftp.microsoft.com/developr/interix/gpl.txt

Reply via email to