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

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

Thread Previous | Thread Next
From:
Ricardo Signes
Date:
August 24, 2012 17:54
Subject:
Re: fixing smartmatch just hard enough (and when, too)
Message ID:
20120825005401.GD28396@cancer.codesimply.com
* Damian Conway <damian@conway.org> [2012-08-24T08:14:03]
> Abigail observed:
> > On top of that, for years we have been buggering people on use of "$var"
> > as being bad practise, and now we want a warning to promote it?
> 
> The warning doesn't have to promote it. The warning could say:
> 
>      Ambiguous operand ($x) in smartmatch at example.pl line 7
>      (Did you need eq or == instead?)

Ideally, we will reduce the ambiguous cases quite a bit with the magicflags
patch, in which case we can simply say "%s not allowed as smartmatch matcher"
for qw(typeglob dualvar ?).  The circumstances should be rare, and resorting to
perldiag for the likely cause and potential solutions seems fair.

As things stand now, we'd need something more, and I think given the use of a
matcher as a passed-around value test, the ""/0+ is "better."  And by "better"
I mean, "let's get that magicflags stuff sorted out."

-- 
rjbs

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