>>>>> "GB" == Graham Barr <[EMAIL PROTECTED]> writes:

>> Yup. But the vtbl approach allows us to merge op calls and user sub calls
>> into one method.

GB> Ah, you are suggesting something like,

GB> every known sub name is assigned a number and each package has an array
GB> and the op just contains an index.

GB> These arrays would get big and a sparse array implementation would loose
GB> most of the benefits it would have over what we do in perl5. But we would
GB> also still need a big hash to convert to indexes for dynamic subname lookup.

GB> Or am I missing it by a mile ?

What I see is

Each sub has a unique number.

Package A - Has nothing blessed, doesn't need the lookup table

Package B - Has blessed items, lookup table for all subs that are part
            of the package, or in the inheritance tree.

            So this table would be sparse. But limited number, mapping
                sub unique number -> offset in vtbl

Each object would then have a compact representation of only the methods
that are accessible via method call. (Dynamically generated methods,
would be added at the end of the vtbl.)

There only has to be a single vtbl for all objects. Since all objects
with the same @ISA would act the same.

Does it sound workable?

Hmm, I just thought of some scenerios that could break it.

method A::a is redefined, all the pointers are now invalid.  (A
solution could be to leave a stub in place that would fixup the
caller.)

Dynamic changes to @ISA would invalidate all the vtbls. (Hmm, since
there is only a single copy, changes to @ISA would rebuild the
vtbl.)

Package A inherits from Package B. Package A decides to dynamically
define method A::a after several objects have already inherited a from
B::a. (We could track all objects blessed into a package and do a
fixup. But unless we need this list, for other reasons, it would be a
waste just for this scenerio.)

<chaim>
-- 
Chaim Frenkel                                        Nonlinear Knowledge, Inc.
[EMAIL PROTECTED]                                               +1-718-236-0183

Reply via email to