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

Re: smartmatch needs your eyes

Thread Previous | Thread Next
From:
H.Merijn Brand
Date:
September 10, 2015 16:10
Subject:
Re: smartmatch needs your eyes
Message ID:
20150910181011.04897335@pc09.procura.nl
On Thu, 10 Sep 2015 16:58:02 +0100, "Paul \"LeoNerd\" Evans"
<leonerd@leonerd.org.uk> wrote:

> On Thu, 10 Sep 2015 17:42:24 +0200
> "H.Merijn Brand" <h.m.brand@xs4all.nl> wrote:
> 
> >     $x ~~ 42        -->     $x == 42        ???
> >     $x ~~ "foo"     -->     $x eq "foo"     ???  
> 
> I expect not.
> 
>    my $x = 1;
> 
>    $x ~~ "1.0"
> 
> does what? It's this "try to guess from many possible types of match"
> that is deemed the core problem of toosmartforitsowngood-match in the
> first place.

If the case was keep it simple, your example would fail, as

  $x ~~ "1.0"  => 1 eq "1.0" which is false, and I would accept that

your case would be valid for

  $x ~~ 1.0    => 1 == 1.0 

where it would match, and again I tend to agree

-- 
H.Merijn Brand  http://tux.nl   Perl Monger  http://amsterdam.pm.org/
using perl5.00307 .. 5.21   porting perl5 on HP-UX, AIX, and openSUSE
http://mirrors.develooper.com/hpux/        http://www.test-smoke.org/
http://qa.perl.org   http://www.goldmark.org/jeff/stupid-disclaimers/

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