At 07:19 PM 8/1/00 +0100, Alan Burlison wrote:
>Tony Payne wrote:
> > Strong support for OO (including the ability to have compile-time method
> > lookups)
>
>Bit difficult when polymorphism enters the picture - I guess this is
>more a request for intelligent optimisation, although I suspect an
>easier fix is to make the overhead of calling a method cheap enough that
>nobody notices the difference between that and a non-polymorphic call.
Polymorphism whacks this a bit, but the optimizer can help you cheat some.
If you have this:
my $dog : Spot;
$dog->foo();
there's no reason the opcode for the method call can't have a pointer to
Spot::foo stuffed in it, and do the long-form look up only if $dog's not
really Spot. (And we could cache some unique package ID in both the opcode
and the object so we could tell with a simple integer compare if the object
matches the method's cached stash)
Dan
--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
[EMAIL PROTECTED] have teddy bears and even
teddy bears get drunk