On Thu, Mar 11, 2004 at 02:05:55PM -0600, Jonathan Scott Duff wrote: : On Thu, Mar 11, 2004 at 11:11:54AM -0800, Larry Wall wrote: : > On the final hand, if people fall in love with both self:sort and =sort, we : > could have =sort be a shorthand for self:sort where it's unambiguous. : : Wouldn't =sort potentially muck with POD?
Could. Historically pod only pays attention to = on the left margin though. So you generally wouldn't have any problem unless you were in the habit of declaring your methods in the C-ish idiom of: int method =rotate (int $a is rw) {...} On the other hand, I suspect most people will end up declaring it int method self:rotate (int $a is rw) {...} in any event, and reserve the =rotate for .=rotate, which can never put the = on the left margin, even if we let ourselves have whitespace before POD directives. So maybe we just require self: for the declaration, and forget about = there. It interacts badly with global names anyway. Is it "*=sort" or "=*sort"? With "*self:sort" it's more obvious. Another interesting question, if the "postfix:.=foo" mess is defined with as self:foo, should infix:+= be defined as self:+ instead? In other words, should the <op>= syntax really be a metasyntax like hyperoperators, where you never actually have to define a C<»+«> operator, but the hyperoperator is always autogenerated from ordinary C<+>? So basically any infix:<op>= gets remapped to self:<op>. In that case, C<»+=«> is a double-meta operator that ends up generating a hyper self:+. I kinda like this approach because it means you can always get all of $a !! $b $a !!= $b @a »!!« @b @a »!!=« @b merely by defining infix:!!. On the other hand, it also means that someone can say silly things like: $a cmp= $b $a ~~= $b I suppose we could simply disallow meta-= on non-associating operators. Can anyone come up with a non-associating binary operator that *should* have an assignment operator? The basic definition of non-associating seems to be that the type of the arguments is incompatible with the type produced by the operator. Which is precisely the problem with something like $a cmp= $b insofar as $a is being treated as a string at one moment and as a boolean at the next. Larry