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

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

Thread Previous | Thread Next
Ricardo Signes
August 24, 2012 17:54
Re: fixing smartmatch just hard enough (and when, too)
Message ID:
* Damian Conway <> [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 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."


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About