Autrijus Tang
Thu, 14 Jul 2005 19:01:21 -0700
On Fri, Jul 15, 2005 at 02:38:22AM +0300, Yuval Kogman wrote:
> As I see it == is the generic comparison, and 'eq' is == with
> coercing parameters (in Haskell it'd be
> eq :: (Show a) => a -> a -> Bool or so... Isn't that lovely?)
There is a new generic comparison operator known as ~~.
The dispatch for ~~ is governed by MMD that acts on the type classes --
I mean roles -- of both sides. I wonder if we can make eg:
role SmartMatchEq {
method sm_eq ($x: $y) { ... }
}
multi infix:<~~> (SmartMatchEq $x, SmartMatchEq $y) {
$x.sm_eq($y)
}
Is that close to what you want?
Thanks,
/Autrijus/
pgpcsCh4xCa7z.pgp
Description: PGP signature