develooper Front page | perl.perl5.porters | Postings from August 2012

Re: fixing smartmatch just hard enough (and when, too)

Thread Previous | Thread Next
From:
philippe.bruhat
Date:
August 29, 2012 06:04
Subject:
Re: fixing smartmatch just hard enough (and when, too)
Message ID:
20120829130437.GI15993@swoosh
On Fri, Aug 24, 2012 at 07:32:32AM -0500, Jesse Luehrs wrote:
> 
> I'm starting to think that only allowing string matching (as in the
> initial proposal) is going to be the only sane option here/: It's not
> like numeric matching would be all that much harder even with that form:
> '$thing ~~ sub { $_[0] == 2 }' or 'when { $_ == 2 } { ... }'.
> 

Also, there's already a case where Perl defaults to string comparison:
sort.

To sort numerically, we have to write sort { $a <=> $b }. So it seems
consistent with existing behaviour.

-- 
 Philippe Bruhat (BooK)

 Fantasy is a nice vacation but Reality is where you spend your life.
                                    (Moral from Groo The Wanderer #44 (Epic))

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About