There's no need to ask essentially the same question three times. https://docs.raku.org/routine/range <https://docs.raku.org.routine/range> is quite clearly the wrong page. That's about a method on the class X::OutOfRange, and not a method on Int. You want https://docs.raku.org/routine/Range, which will unfortunately not be much more useful.
Your original error message "Invocant of method 'Range' must be a type object of type 'Int', not an object instance of type 'Int'" is much more useful. Your variable $u contains a variable of type Int. What the method Range wants is a "type object of type 'Int'" which is not the same thing.This is what you would get with a definition like "my UInt $u;". $u is now a variable containing no definite value, but is of type UInt. If you were to "say $u" you would get "(UInt)", which is a type object. "say $u.Range" would then give "0..^Inf". This is related to the ":D" and ":U" forms in signatures. "sub x(Int:D $arg)" would require the subroutine to be passed an actual object of type Int. "sub y(Int:U $arg)" would need to be passed a "type object of type 'Int'". If you were to check the source you would find the signature of Range to be something like "method Range(Int:U --> Range)". Kevin. On Tue, 28 Jan 2020 at 16:09, ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > Hi All, > > On https://docs.raku.org/routine/range, it states: > > method range(--> Range:D) > > What is being said? > > method I understand. > > Range would be the name of the method > > --> means is return the range of what was fed the > method and is defined > > > This one ain't all the hard to decipher. > > So why does this not work? > > > my int8 $u = 0xF8; $u.range > > No such method 'range' for invocant of type 'Int'. Did you mean any of > these? > Range > rand > > > Perplexed, > -T >