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]

  ::eqv ::= none(=:=); # non-Object Comparer

The difficult part is the definition of inhomogenious cases
by means of MMD unless we can form supertypes of Comparers
easily:

  role Foo does Compare[Object|Num, =:= | ==]

or with set syntax and a bit de-sugared on the op:

  role Foo does Compare[(Object,Num), (&infix:<=:=>, &infix:<==>)]


The driving idea here is that the syntactical choice of the programmer
amounts to a type preference of the Comparer subtype. 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.
--
$TSa.greeting := "HaloO"; # mind the echo!

Reply via email to