On Tue, Aug 28, 2012 at 2:43 PM, Ricardo Signes <perl.p5p@rjbs.manxome.org>wrote: > given ($x) { > when ($y) { ... } # $x ~~ $y > when (4) { ... } # $x == 4 > when ('4') { ... } # $x eq 4 > } > > Deferred/computed values of any sort mean smart match. > > Two dead-simple special cases: Numeric literals mean ==. String literals > mean > eq. > I agree this solves many of the technical issues raised, but I fear that it's going to confuse some people or mis-set expectations. * Currently when() does smartmatch, so you have to retrain people not to think of when() as smartmatch, but to think of when() as a "smart switch" or something. * You can test a value with when() that you can't smartmatch, so if people don't internalize that when() is no longer smartmatch, at some point they'll smartmatch a literal and expect it to work like when. Since smartmatching a literal isn't ambiguous, I think that it would be less confusing to just add literals to the smartmatch table and let when() stay as smartmatch. That means *one* big change instead of two. FWIW, I would still like "when {...} {...}" as a shorter way to write "when (sub{...}) {...}", but think that's "nice to have" and not necessary for fixing smartmatch. David -- *David Golden* <dagolden@cpan.org> *Take back your inbox!* → http://www.bunchmail.com/ Twitter/IRC: @xdgThread Previous | Thread Next