On Fri, Aug 24, 2012 at 02:51:35PM +0200, Leon Timmermans wrote: > On Fri, Aug 24, 2012 at 3:08 AM, Damian Conway <damian@conway.org> wrote: > > In other words, every single time an object is the LHS operand of a > > smartmatch, we need (at least the option) to be able to have that object > > decide how the match should work. > > I guess. Conceptually left handed matching and right handed matching > feel like completely different, because left hand is usually about the > $self and right handed is about the $other, to the point where I'd > almost suggest making them separate for purposes of operator > overloading. Yes, I think that at the very least we should do this. Almost nothing makes sense to appear on both the left and right sides of a smartmatch (junctions being the only exception I can think of). Smartmatch isn't commutative, so every single smartmatch overload will need to look like sub { my ($left, $right, $swap) = @_; if ($swap) { ... } else { ... } } or else it will be pretty broken, so I think that should be enforced by the overloading mechanism itself. -doyThread Previous | Thread Next