Larry wrote:

Or we could have a different operator that coerces like == and eq, only
via .snap:

    if [1,2,3] equals [1,2,3]     { say "true" } else { say "false" }

(Actual name negotiable, of course).  The advantage of the latter approach
is that you can say

    @foo >>equals<< @bar

and the .snaps are automatically distributed.  Otherwise you'd have to say

    @foo<<.snap >>eqv<< @bar<<.snap

which is a pain.  On top of which, equals doesn't actually have to
implemented in terms of .snap--it could just compare the current
values of the mutable objects directly.  (Just as =:= doesn't have
to be implemented in terms of .id.)

Just a meta-point...one thing we really do need to be careful of is not ending up with 17 different "equality" operators (like certain languages I shall refrain from naming). So far we're contemplating:

        =:=
        ~~
        ==
        eq
        eqv
        equals

Do we really need even that many???

Damian

Reply via email to