如何在Perl 6中定义一个自定义的整数数组引用类型?我尝试了下面的代码,但是它并不起作用:
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 ...
has Int @.option
,但在此之前我并不知道。 - sid_com