On 07/03/17 17:59, Sean McAfee wrote:
> […] If I want to freely accept both numbers and strings in the manner > of
> Perl 5, it looks like I must type all of my function arguments as
> Cool, or omit the types altogether. […]
Don't forget you can use a coercive type in parameter lists:
sub postfix:<!>(Int(Cool) $n) { [*] 2 .. $n }
That'll explode early when the string you pass doesn't intify properly.
It'll also allow you to pass lists and use their length for example -
not sure if you want that.
Hope that helps!
- Timo