From: Leopold Toetsch <[EMAIL PROTECTED]>
   Date: Sun, 27 Mar 2005 16:37:41 +0200

   1) Mixed infix operations

   Opcodes that take one PMC and one native type argument, like:

      op add(in PMC, in PMC, in INT)

   should probably become plain vtable methods again. There isn't much 
   "multi" in the dispatch as the dispatch degenerates to a search in the 
   class of the left argument's MRO. OTOH this may have some implications 
   as Perl6 is treating these as normal multi subs.

IMHO, one can have too much overloading.  It seems cleaner to
distinguish between "+, the (sometimes overloaded) HLL operator" and
"add, the Parrot addition operator" so that compiled code can opt out of
the overloading when the compiler knows that it really needs to do mere
addition.

   Maybe we need just a fake "int" class for the sake of MMD.

I think this is a really good idea.  Indeed, I think it's hard to do
otherwise; you need some place to store the "isa" relationships between
PMC classes for primitive types.  Beyond that, I think it's good to
minimize the distinction between PMC classes and ParrotClass classes
from the perpective of HLLs; implementors are then freer to use a
ParrotClass to start, and reimplement as PMCs later for speed.

   BTW, I just noticed that "pmclass ParrotObject extends ParrotClass
..."; is this right?  Seems like the class and instance hierarchies
ought to be disjoint . . .

   5) infix method signature change . . .

   We need this basically for 4 reasons:

   a) Python
   All Python scalars are immutable. The current scheme to morph the 
   destination PMC to the type of the result is basically wrong. All Python 
   operations on scalars always return a new result PMC.

This is also how Common Lisp prefers to view the world.

   . . .

   7) separate inplace methods

   Opcodes like:

      d += r    # add d, r

   are currently using the normal add method with the destination set to 
   SELF. This is suboptimal, especially, when the destination PMC is 
   morphed to a different type (e.g. due to bigint promotion) which 
   destroys the value of SELF.

   It's just cleaner to have distinct inplace methods, it's very likely 
   also needed anyway, as method overloading would not work if the inplace 
   operations are the same.

It also allows "$a = $a + $b" to have different semantics from
"$a += $b" for suitably defined operators and values.  Not that I can
think of a reasonable example off the top of my head . . .

                                        -- Bob Rogers
                                           http://rgrjr.dyndns.org/

Reply via email to