At 01:14 PM 02-07-2001 -0500, Dan Sugalski wrote:
>At 01:35 PM 2/7/2001 -0200, Branden wrote:
>>As far as I know (and I could be _very_ wrong), the primary objectives of
>>vtables are:
>>1. Allowing extensible datatypes to be created by extensions and used in
>>Perl.
>
>Secondarily, yes.
>
>>2. Making the implementation of `tie' and `overload' more efficient ('cause
>>it's very slow in Perl 5).
>
>No, not at all. This isn't really a consideration as such. (The vtable
>functions as desinged are inadequate for most overloading, for example)
Hmm, I seem to remember vtables were being cited as a cure for lots of ills
(perhaps combined with other aspects, like "make Perl nearly as fast as C".)
The vtables were implied (or possibly out-right stated) as giving the
low-level core a more object-oriented structure: as you state below,
branching and conditionals in the runtime can be eliminated by the values
knowing how to operate on themselves.
It was also implied (or out-right claimed) that different
objects/classes/packages/whatever could have class-specific vtables,
defined at run-time, that would be used to handle the class-specific
implementation details. I'm not sure what that could refer to except ties
and overloading; class-specific methods wouldn't go in the vtable.
There was some discussion that allowing the vtables to refer to functions
written in perl would be a good idea, as it would allow extensions to be
written in perl -- which is a good thing.
I had gotten the impression that the perl code-sequence:
$a = $b + $c;
would generate the same op-code sequence regardless of the type of $a, $b,
$c, and the vtables would do all the magic behind the scenes, calling tied
or overloaded versions of the base functions if so defined for $a, $b, or $c.
Now I seem to be hearing that this is not the case, that variable ties and
overloads are at a much higher level, never touching the vtables. It now
seems that the vtables will exist only for built-in types, and be
inaccessible for user-defined types (unless those types are defined by the
perl6 equivilant of XS, for example). This almost seems to be defaulting
on the promise of vtables I thought was made.