develooper Front page | perl.perl6.language | Postings from July 2006

Re: ===, =:=, ~~, eq and == revisited (blame ajs!) -- Explained

Thread Previous | Thread Next
From:
Jonathan Lang
Date:
July 13, 2006 22:36
Subject:
Re: ===, =:=, ~~, eq and == revisited (blame ajs!) -- Explained
Message ID:
ef30550b0607132236j68ad4b99lf377e7d9bc229a2a@mail.gmail.com
Yuval Kogman wrote:
> Jonathan Lang wrote:
> > Apparently, there are _four_ basic kinds of comparison: the ones
> > mentioned above, and == (I believe that eq works enough like == that
> > whatever can be said about one in relation to ===, =:=, or eqv can be
> > said about the other).  I'd be quite interested in an expansion of
> > David's example to demonstrate how == differs from the others.
>
>         sub &infix:<==> ( Any $x, Any $y ) {
>                 +$x === +$y; # propagate coercion failure warnings to caller
>         }
>
>         sub &infix:<eq> ( Any $x, Any $y ) {
>                 ~$x === ~$y
>         }

So the purpose of === is to provide a means of comparison that doesn't
implicitly coerce its arguments to a particular type?

-- 
Jonathan "Dataweaver" Lang

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