Hello,
I have a function like this:
sub test(Str :$format, :@filter)
{
say $format;
say @filter;
}
and I wish to have a stricter type control over the second parameter.
The natural way to do it seemed this:
sub test(Str :$format, Array[Str] :$filter)
{
say $format;
say $filter;
}
but then I have to call it this way:
test format => 'gnutar', filter => Array[Str].new('gzip', 'uuencode');
Is there a less cumbersome way to do it?
Obviously this doesn't work:
test format => 'gnutar', filter => <gzip uuencode>;
because the argument is interpreted as a generic List.
This doesn't work either:
test format => 'gnutar', filter => ['gzip', 'uuencode'];
because it's interpreted as a generic Array, not an Array[Str].
Thank you!
--
Fernando Santagata