Leopold Toetsch wrote:

2) Vtable entries should be real methods

All non-defaulted, non-inherited entries of a vtable interface should be available as methods, like now with the METHOD keyword. This allows eventually code like this:

   Px = Py."__pop_pmc"()

or

  Px = Py."__string"()        # $x = ~$y   string kontext

This easily allows overloading of all the vtable methods. The PIC code gets even rid of the additional indirection as the function is called directly from opcodes. The vtable slots are just for calling these methods from within C source.

As long as find_method itself can be overridden, this above is merely a description of the default behavior, not a hard requirement.


3) MMD functions

They work basically like other methods except that there is no VTABLE slot and the method lookup is more complicated. The more detailed (and very preliminary) proposal below has some additional MMD functions that we'll need (IMHO):

   "__i_add"(Px, Py)        # $x += $y
   Px = "__n_add"(Py, Pz)   # x = y + z  ; x is newly created

The distinct slots for the inplace operations are at least necessary for Python, as these are separate methods in Python. It also simplifies the implementation as a check for "self == dest" isn't necessary in the plain operations.
The variants with an "n_" prefix create and return a new PMC.

I continue to believe that it is not a good idea for Parrot to decide apriori exactly which methods are to be mmd universally for all languages and all objects.


- Sam Ruby



Reply via email to