(cross-posting to p6l) Ryan Richter wrote: > On Thu, Jun 26, 2008 at 11:36:05AM +0200, Moritz Lenz wrote: >> 2) How do we know which numeric type is a class and which is a role? Is >> there an explicit spec about the types of number literals? That could >> have some impact on type checking in the tests. (Maybe I should prod p6l >> with that). > > You can't instantiate a role so they're pretty much all classes I think. > The only role that I saw specced was Order, and Num does Order so all > Num types inherit that. Complex is its own type separate from Num, and > everything else descends from Num. See docs/p6types in pugs, it's meant > to answer these questions :)
Thanks for the effort, but it also raises new questions. For example: > Int is Num Rakudo doesn't do it that way, because the 'A is B' relation in OO means "Every instance of A is also an Instance of B", which certainly isn't the case with Ints. Int is more like a subset of Num. Which made me think, shouldn't Num be a role? and then 3.14 would be a Rat or a Float or whatever, 42 would be an Int, and Int does Num Rat does Num That way a compiler that only implements classes and roles (and no subset types) can get the hierarchy of numeric types right. Cheers, Moritz -- Moritz Lenz http://moritz.faui2k3.org/ | http://perl-6.de/