On Tue, Jul 16, 2002 at 03:35:30PM -0500, David M. Lloyd wrote: > On Mon, 15 Jul 2002, John Porter wrote: > > > > There is really no inheritance of any kind going on, > > > it just sticks pointers to the default functions into the vtable > > > structure method entries for undefined methods. > > > > But that's what type inheritance is! > > Not really. There is only one "base class". Also, you're not inheriting > a data structure or member variables. All you "inherit" (which actually > happens at compilation of the PMC) are "member functions". If you happen > to use your data differently than default.pmc then these functions are no > longer valid. > > If any of this is to change then I haven't heard of it.
Unless it's been removed since I implemented it, it is *possible* to do inheritance from classes other than 'default'; it's just that nobody has chosen to. There is an 'extends' keyword that allows you to specify a different base class. As you said, it's still only method inheritance, but that's most of what inheritance is anyway (perl5 doesn't have much in the way of field inheritance, for example.) As for it happening at compile-time -- the same is true of 90% of the languages out there. Some of the existing PMCs probably could take advantage of this -- Array and PerlArray come to mind. Except I've never really understood the difference between those two. A separate Hash from PerlHash would make a lot more sense to me (Hash would be String->Num|Int|String|PMC, PerlHash would be PMC->PMC.)