Re: disable coercing?

[email protected] (Joseph Brenner)
Newsgroups perl.perl6.users
Message-ID <CAFfgvXX_OO-=Ld9t9su7z=2yagp=kCU9Ojfr+wiVFG=cpjUATQ@mail.gmail.com>
Would this trick help?  You can define a "subset" that restricts
values to the uint16 range:

     my subset FussyUint16 of Int where 0 ..^ 2¹⁶;
     my FussyUint16 $x;
     $x = -1;
     ## Type check failed in assignment to $x; expected FussyUint16
but got Int (-1)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.