> At 02:18 PM 10/4/2001 +1000, Damian Conway wrote:
   > >    > ** Miscellaneous
   > >    >
   > >    > Why 'operator:+' instead of 'operator::+'? (Other than the
   > >    > potential verbosity required to declare operators within a
   > >    > particular package.) I would think it more intuitive to think of
   > >    > 'operator' as a provided package (within every package).
   > >    >
   > >    > Hmm, lexicals.
   > >
   > >Yep. Overloaded operators will be inherently lexical (to keep them from
   > >running amok), so they can't be in packages.
   > 
   > This is for when we change the parser, right? Overloaded operators
   > attached to variables will leak out and go wherever they go.
   > 
   >     $foo + $bar
   > 
   > will call $foo's overloaded add if it has one no matter where $foo's used.

Sorry. I should have been clearer.

Dan is, of course, correct. Overloaded operators that are class methods
will tag along with their objects as they currently do (as indeed, *all*
methods currently do).

Overloaded operators that are subroutines will stay firmly fixed in their
own lexical scope (as indeed *all* lexical subroutines will).

Damian

Reply via email to