The PMC compiler[1] needs some improvements: method inheritance.

We have e.g. classes/float.pmc with a bunch of methods:

   METHOD PMC* cos() {
     ...

The PMC compiler creates code [2] so that these methods are installed into the "Float" namespace at class_init time.

But all these methods should be available for Integer too, so that

  .local pmc x, y
  x = new Integer
  x = 1
  y = cos x

does the right thing.

The plan is to move these methods to classes/scalar.pmc, which is a common ancestor of Float and Integer. But moving e.g. the "cos" function into scalar.pmc makes it just being ignored. Thus the PMC compiler should emit code so that functions defined with METHOD are inherited exactly like plain vtable functions. The class_init code should have an enter_nci_method with the appropriate namespace of the class.

Thanks,
leo

[1] build_tools/pmc2c.pl, lib/Parrot/Pmc2c.pm
[2] classes/float.c:..class_init enter_nci_method ..
    see also the created *.dump files

Reply via email to