Nicholas Clark <[EMAIL PROTECTED]> wrote: > 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? Yep. > 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. See e.g. dynclasses/tclint.pmc:class_init(): void class_init() { if (pass) { ... lookup your types At this pointer classes are registerd and have type enums. > 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. For sure doable too, but looks a bit fragile. > Nicholas Clark leo