Re: Array containing only elements that implement a role.

2017-01-03 Thread Siavash
Hi, It's because of the default value of array elements. See the end of this section: https://docs.perl6.org/language/list#Typing my @a; say @a.of.perl; # Mu say @a.default.perl; # Any say @a[0]; # (Any) role Foo {}; my Foo @a; say @a.of.perl; # Foo say @a.default.perl; # Foo say @a[0] # (Foo)

Array containing only elements that implement a role.

2017-01-03 Thread Martin Barth
Hi There, I am not sure if my RoleType @array; is correct, or if there is a better way to declare such an array. But I find the error that is happening when there are no elements in the array confusing on the first sight. It took me a while to realize that my array was empty and therefore it