Dan Sugalski <[EMAIL PROTECTED]> wrote: > There's a flag in the flags field to mark the PMC as a permanent type > or not. It's insufficient for "Type X or child of X" things, though. > > >Or to put it another way, is the type of a PMC determined purely by > >it's current vtable pointer, and if so, under what circumstances > >are we allowed to change the pointer? > > The variable's vtable functions are the only things allowed to change > that pointer. The circumstances under which they change it are up to > the authors of the vtables. For standard types we need to hash some > things out for it. > > >And can we indeed conflate the concepts of type as defined by a vtable > >pointer, and Perl-level type? Will there always be a seaprate vtable > >for each Perl-level type???? > > There will be at least one vtable per perl-level type, yes. Each > package and class gets at least one, as do any lower-level > user-defined types.
All sounds good to me. My outstanding niggle is when a typed variable is undef. I guess we need a generic Perl_Undef_But_Typed vtable type, which behaves mostly like the PerlUndef type, but saves a pointer to its 'real' vtable in self->data or whatever. When it's assigned to, it upgrades itself to its real type, then passes control to it's real type's assign method.