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

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

Thread Previous | Thread Next
From:
Ed Avis
Date:
August 17, 2012 05:20
Subject:
Re: fixing smartmatch just hard enough (and when, too)
Message ID:
loom.20120817T140852-507@post.gmane.org
Eirik Berg Hanssen <Eirik-Berg.Hanssen <at> allverden.no> writes:

>If your C<eqv> is merely C<eq>, you'll have to accept that stuff that overloads
>C<eq>, like junctions, have their own idea of list membership.

Good point.  I was assuming that there is a concept of scalar equality defined
by the language and accessible to the programmer directly.  But this is not the
case, it seems; you cannot use 'eq' to reliably compare two scalars for equality,
since C<'a' eq any('a')> even though 'a' and
'Perl6::Junction::Any=ARRAY(0x2488048)' are manifestly different things.

If there is not a reliable equality operator then it makes no sense to ask for
a list membership operator.  So perhaps C<$x eq any(@a)> is the best we are going
to get, even though as mentioned it does not reliably test list membership.

-- 
Ed Avis <eda@waniasset.com>


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