On Thu, Jun 26, 2008 at 11:36:05AM +0200, Moritz Lenz wrote: > There seems to be a thorough confusion about numeric types. for example > some tests read like this: is (1.1).WHAT, 'Num'; and then in a different > file is (1.1).WHAT, 'Rat'; That raises two questions for me > 1) should we test for the value of .WHAT at all (unless for testing WHAT > of course)? It seems to me that a compiler should have the freedom to > return a different subtype (for example 1 could be a PositiveInt as long > as PositiveInt is an Int; that's a contrived example, but you get the > picture)
Right, it's hard to imagine that ever being a correct test. It should probably be using ~~ Num etc. > 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 :) -ryan