Yuval Kogman writes: > More! > > can you have several slurpy params, of the same type, which are > assigned contiguous sequences of the thing they can slurp? > > foo([EMAIL PROTECTED], *%a, [EMAIL PROTECTED]) > foo(1, 2, 3, a => b, c => d, 4, 5, 6); > > for me that makes sense for slurpy blocks, but not anything else
I don't think so. If the signature didn't give you an error for doing that (which it would), we could expect these bindings: @a : [1, 2, 3, a => b, c => d, 4, 5, 6] %a : {} @b : [] Slurpy array is a greedy bastard. Slurpy hash is only greedy for pairs, and it stops trying after it sees something that is not a pair. But that makes me wonder whether you can do this: sub foo ($a, $b, *%options, &code) Given how I've described the slurpy hash above, that should work fine. But given the current semantics, that doesn't work. Perhaps, in the absence of accepting my more general proposal, we could just define a left-to-right matching order. Named arguments would be assumed to be part of a slurpy hash (and must always come immediately before a slurpy hash if there is one). Likewise with slurpy scalars. But it would allow things like this: sub svn (*%svnopts, $command, *%commandopts) Which authors would have their own reasons for writing. Luke