Atmosphere: Whooosh Mug: Clunk Luke's head: Thud Luke's wall: Dum Luke: Ow Violence is fun!
On Sat, Jul 16, 2005 at 19:02:49 -0600, Luke Palmer wrote:
> I'm going to have some coffee mugs thrown at me for saying this, but perhaps:
>
> Generic String Numeric Identity
> +-----------+---------------+----------------+---------------+
> Equality | == | =~= | =+= | =:= |
> +-----------+---------------+----------------+---------------+
> Comparison | > < >= <= | ~> ~< ~>= ~<= | +> <+ +<= +>= | $a.id < $b.id |
> +-----------+---------------+----------------+---------------+AA
I have another view.
The Num role and the Str role both consume the Eq role. When your
class tries to both be a Num and a Str, == conflicts.
I have two scenarios:
class Moose does Num does Str { ... }
# Moose was populated with:
multi method infix:<==> (Moose does Num, Moose does Num) { ... }
multi method infix:<==> (Moose does Str, Moose does Str) { ... }
OR
# Str and Num try to add the same short name, and a class
# composition error happenns at compile time.
Recently I discussed MMD with chromatic, and he mentioned two things
that were very important, in my opinin:
* The Liskov substitution principal sort of means that MMD
between two competing superclasses, no matter how far, is
equal
* Coercion of parameters and a class's willingness to coerce
into something is a better metric of distance
Under these rules the way this would be disambiguated is one of:
- Moose provided it's own infix:<==>
- Moose said which <==> it prefers, Num or Str. A syntax:
multi method infix:<==> from Str;
(this could also be used for importing just part of a
hierarchy?)
> All in all, generic equality and comparison is something that Perl 5
> did really poorly. Some people overloaded eq, some overloaded ==,
> some wrote a ->equal method, and there was no way to shift between the
> different paradigms smoothly. This is one of the times where we have
> to choose for them.
I wholly agree
--
() Yuval Kogman <[EMAIL PROTECTED]> 0xEBD27418 perl hacker &
/\ kung foo master: /me whallops greyface with a fnord: neeyah!!!!!!!
pgpcPGMrO9PJt.pgp
Description: PGP signature
