如何在 Perl 6 中定义 Int 数组引用的自定义类型?我试过这个,但它不起作用:
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;
关于validation - 如何在 Perl 6 中定义 Int 的 Arrayreference 的自定义类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34612657/