如何在Perl 6中定義Ints的Array-Reference的自定義類型?我想這一點,但它不工作:如何在Perl 6中定義Ints的ArrayReference的自定義類型?
subset Array_of_Int of Array where *.all ~~ Int;
my $n = My::Class.new(option => < 22 3 4 5 >);
# Type check failed in assignment to $!option; expected My::Class::Array_of_Int but got List in block <unit> at ...
我只需要'爲int @ .option',但我不知道之前。 –