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

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

Thread Previous | Thread Next
August 29, 2012 06:04
Re: fixing smartmatch just hard enough (and when, too)
Message ID:
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:

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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About