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

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

Thread Previous | Thread Next
David Golden
August 22, 2012 06:00
Re: fixing smartmatch just hard enough (and when, too)
Message ID:
On Wed, Aug 22, 2012 at 7:44 AM, Damian Conway <> wrote:

> In particular, I'm now proposing to fix the number/string ambiguity by
> making *any* ambiguous case fatal, rather than falling back on eq
> when we're not sure. So we only do == when we're certain it's a
> number, and only do eq when we're certain it's a string, and if we're
> not certain, we always die.

I'm very happy with the summary and proposal with the exception of this
piece.  Rarely in Perl do we die on ambiguity and I can't think of any case
involving scalar string/number mutability.  (E.g. perldata is pretty clear
about not needing to worry about such conversions.)

I would prefer the Any ~~ AmbiguousScalar case to warn and fall back to
string comparison.  If someone wants to die on ambiguity, they can make the
warning fatal.

I think this gentler approach would be more Perlish.

-- David

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