Is this code syntactically and conceptually correct?

 method postfix:<++> (-->::?CLASS)
 is export
  {
  my ::?CLASS $temp = self;
  self =. successor;
  return $temp;
  }
 
 method prefix:<++> (-->::?CLASS)
 is export
 is rw
  {
  self =.successor;
  return self;
  }

In particular, are pre/postfix functions defined as methods inside a class (or 
role, as the case may be)?  I'm guessing that 

     ++$x

will first see that prefix:<++> is a member of that class, and do method 
dispatch on it.

So, does making it "export" mean anything?

Operator or not, if methods are "export", do they need to be multi, or are they 
not multi if dispatched via method but become multi if dispatched as a sub?

--John

Reply via email to