Am 17.11.2010 17:50, schrieb Jon Lang:
If I'm following this correctly, shouldn't we just say that Duration
does Num?
Num is a class (think floating point number).
The role you're looking for is probably either Numeric or Real.
If we say that Duration inherits from Rat or FatRat, it automatically
does both roles.
That way, a Duration can be used exactly like a Num is
(with units measured in seconds); but it could also have special
capabilities above and beyond what a Num can do, if such capabilities
are needed.
Right. That's what role composition, inheritance and possibly other
forms of subtyping are about.
More generally, I wonder if maybe we _should_ provide a tool to help
I think this question can only be answered in a meaningful way if
somebody actually implements such a thing as a module (which should be
entirely possible in Rakudo right now). Then we'll see if people take it
up and use it.
That said, it's possible that this would open up a can of worms.
Would it?
Another reason to prototype it as a module.
Cheers,
Moritz