On Mon, Aug 29, 2005 at 14:07:51 +0200, TSa wrote:
> HaloO,
> 
> Damian Conway wrote:
> >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???
> 
> My opinion is there should be a role Compare that takes a
> Comparer as one of it's parameters. For the above we have
> in pseudo syntax e.g.:
> 
>    role Object does Compare[Object, =:=]
>    role Num    does Compare[Num, ==]
>    role Str    does Compare[Str, eq]

What is the implication of from the perspective of the person using
Object, Num and Str?

Do they have one unified comparator?

If so, this sounds like you are subverting MMD with some odd
currying of the 'compare' method (whatever it's name may be)
provided by the Compare role, instead of relying on the already
existing semantics of MMD dispatch to give you the same name for
several, superficially same meanings.

> The driving idea here is that the syntactical choice of the programmer
> amounts to a type preference of the Comparer subtype.

Do you mean on a per class or per comparison basis?

I think that exceptions from the class perspective should not be
done by parametrising the quality role, but overriding it, and that
from the per comparison perspective we need to say either:

        coerce_to_other_type($value)
                generic_equality
        coerce_to_other_type($other_value)

like:

        +$x eqv +$y;

or:

        ~$x eqv ~$y;

and being an operator rich language we can specificate the generic
comparator to make things a bit more fun like I proposed:

        $x +eqv $y;
        $x ~eqv $y;

Ofcourse, I think that s/eqv/==/;, but everyone hates that.


> I fully agree that the number of standard Comparers should be kept
> small---that is close to three, not counting ~~ as a Comparer but
> as (the only) Matcher.

I'm glad that you guys think so too =)

-- 
 ()  Yuval Kogman <[EMAIL PROTECTED]> 0xEBD27418  perl hacker &
 /\  kung foo master: MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM: neeyah!

Attachment: pgp2FmxiAKkJ3.pgp
Description: PGP signature

Reply via email to