On 4/3/07, Jonathan Worthington <[EMAIL PROTECTED]> wrote:
There is a compromise - make them all vtable methods, write a BaseClass PMC and inherit Class from it. BaseClass implements all of the vtable variants of the method, and Class can then provide a sane interface. HLL implementers who need their own class PMC but can implement it in terms of the BaseClass semantics can then derive from BaseClass. (Oh, and I think BaseClass is totally the wrong name, but I know Allison will find a good name too... ;-))

I've asked for something pretty darn close to what you've suggested (see 
#41619), but you've explained it a lot better than I ever could.

What I think you were saying:
                             Default
                                 |
                         BaseClass (default Parrot implementation)
                 /                                              \
             Class                                      UserClass
(PCCMETHOD interface to BaseClass)    (modified version of BaseClass)

Please correct me where I'm wrong :)

Instead of having a BaseClass, which I think would be an unnecessary layer of 
indirection, PMCs implementing class behavior should be able to inherit from 
either:
1. Default: Throw an exception if an unimplemented vtable method is called on 
the PMC.
2. ParrotClass: All semantics are already taken care of, and you need only 
change the behavior where necessary.
The choice of which to inherit from is left up to the PMC implementor.

What I'm saying:
                  Default
           /                    \
      UserClass        ParrotClass (default Parrot implementation)
                                    |
                              UserClass

We could also add "class" to the list of do-able interfaces available to PMCs 
in tools/build/pmc2c.pl.

--
Alek Storm

Reply via email to