On 9/26/18 7:04 PM, Brandon Allbery wrote:
It doesn't. It just improves error messages.
words() produces a list-like thing; that's what really matters, because
list-like things do the Positional role. Declaring it up front lets Perl
6 give you an error message early if you use the result in the wrong way
or if the actual implementation of words() doesn't produce something
that does the Positional role.
pyanfar Z$ 6 'say (sub { [5] })()[0]'
5
I didn't declare the anonymous sub as producing a Positional; it just
returns a List. I then invoke it with (), and apply [] to the resulting
List. It's the fact that it produced a List that matters; any List or
Seq or Array or Buf, etc. can be []-ed,because they all do the
Positional role that defines [].
Uhhh okay.