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

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

Thread Previous | Thread Next
Ed Avis
August 17, 2012 05:20
Re: fixing smartmatch just hard enough (and when, too)
Message ID:
Eirik Berg Hanssen <Eirik-Berg.Hanssen <at>> 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 <>

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