On Mon, Jan 27, 2020 at 23:57 ToddAndMargo via perl6-users < [email protected]> wrote:
> Hi Al, > > Now what am I doing wrong? > > > my Int $u = 0xF8; say $u.Range; > > Invocant of method 'Range' must be a type object of > type 'Int', not an object instance of type 'Int'. > Did you forget a 'multi'? > > When is an Int not an Int? This false statement illustrates: “0xF8 (248) is evenly divisible by 31. 248 is an Int. Therefore, an Int is evenly divisible by 31.” That’s the difference. One is the idea of an Int, the other is a particular Int. In practice, this means that you can get a .Range operation out of the Int type (without arguments, a.k.a. just `Int.Range`, it is the range of all integers from -Inf to Inf), but not out of a particular Int. That would not be well-defined: would it be the range of Ints from zero to the given Int, from 1 to the given Int, or from something different depending on if the Int is a positive or negative number, and would $negativeInt.Range go backwards of forwards? > > Perplexed, > -T >
