On Tue, Apr 26, 2005 at 08:55:21AM +0200, Leopold Toetsch wrote:

> - morph for scalars is ok: e.g. an Integer transforms itself to a Float
> - morph for arbitrary objects must never be done automatically

So really my morph code ought to check the new type to see if it understands
it, and if not throw an exception?

I was wondering on what the best way to do a fast lookup of "is this new class
related to me" is, given that ponie is intending to use dynamic PMCs, so I
can't see a way to make a switch statement on PMC numbers.

The best idea I have so far is actually to compare the address of the morph
function in my vtable with the morph function in the vtable of the new type -
if they are the same, then clearly they're related PMC classes.

I'm not sure if this is good in the general case, but I think it will work
for the 16 (currently) types in the Perl 5 hierarchy.

Nicholas Clark

Reply via email to