On Sun, Aug 1, 2010 at 6:02 PM, Jonathan Worthington <jonat...@jnthn.net> wrote: > No, given-when is smart-matching. The RHS of a smart-match decides what > happens. If you do True ~~ 1 then that's 1.ACCEPTS(True) which is going to > do +True and thus match.
OK, but what about 0 ~~ True? That's what started this thread, extricated from the complicating trappings of given/when. Right now, (anything ~~ True) is true, and IMHO that's a misfeature; it's at least surprising. I'd expect (anything ~~ True) to be synonymous with ?(anything): true only if the LHS boolifies to true. By the same token, (anything ~~ False) would be synonymous with !?(anything). I don't think the capability to use an arbitrary block/sub/method/boolean as a "when" condition should trump the intuitiveness of smartmatching. Instead of overloading the smartmatch, I think we need a different way of specifying a condition that isn't meant to be compared to the topic, and so doesn't invoke smartmatching at all: it's just evaluated in Boolean context as-is. I like the suggestion of "whenever" for that; it has the "no matter what" sense that goes with ignoring the topic. -Mark -- Mark J. Reed <markjr...@gmail.com>