That's not helping. What didn't you understand? Are you still expecting that it is words() that must know all the details of what a list is, because a list can't know what itself is?
On Wed, Sep 26, 2018 at 10:09 PM ToddAndMargo <toddandma...@zoho.com> wrote: > 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. > -- brandon s allbery kf8nh allber...@gmail.com