I just realized, that this isn't an original idea. Objective-C does this.

>From what I recall (hmm, must be close to 10 years now) it had the
same problem in finding the correct c routine to call for any
selector.  Where the selector could be implemented in a seperate
objecte file.

Anyone on this list familiar with Objective-C and its dispatching method?

<chaim>

>>>>> "CF" == Chaim Frenkel <[EMAIL PROTECTED]> writes:

CF> Each sub has a unique number.

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

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

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

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

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

CF> Does it sound workable?

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

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

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

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

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




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

Reply via email to