Re: disable coercing?
[email protected] (ToddAndMargo via perl6-users)
| Newsgroups | perl.perl6.users |
|---|---|
| Message-ID | <[email protected]> |
On 2/25/24 17:45, Joseph Brenner wrote: > 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) I got around it by cleaning up my act. It was really my fault for not respecting what Raku was trying to do. Since I endeavor to define all my variables, I should have known better.