develooper Front page | perl.perl5.porters | Postings from September 2015

Re: smartmatch needs your eyes

Thread Previous | Thread Next
From:
Eric Brine
Date:
September 10, 2015 20:01
Subject:
Re: smartmatch needs your eyes
Message ID:
CALJW-qHdWgriepGQoYAj7uXbYya2HpOzrBGTULR=k_ipU9dBGA@mail.gmail.com
On Thu, Sep 10, 2015 at 11:42 AM, H.Merijn Brand <h.m.brand@xs4all.nl>
wrote:

> On Thu, 10 Sep 2015 11:26:08 -0400, Ricardo Signes
> <perl.p5p@rjbs.manxome.org> wrote:
>
> > As a reminder, and adding one small change, the new behavior is:
> >
> >   # STEP ONE
>     $x ~~ 42        -->     $x == 42        ???
>     $x ~~ "foo"     -->     $x eq "foo"     ???
> >   $x ~~ $qr       -->     $x =~ $qr
> >   $x ~~ /.../     -->     $x =~ /.../
> >   $x ~~ sub{...}  -->     $sub->($x)
> >   $x ~~ undef     -->     ! defined $x
> >   $x ~~ obj       -->     uses ~~ overloading if present, otherwise pass
> >
> >   # STEP TWO
> >   $obj ~~ $x      -->     uses ~~ overloading if present, otherwise pass
> >
> >   # STEP THREE
> >   $x ~~ $y        -->     fatal
>

Does 42 specifically refer to a numeric literal, or any scalar that's a
number? There is no practical way of determining if a scalar is a number
(as opposed to a string), so the latter isn't possible, which will make
allowing the former a support nightmare.

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