Daniel Ruoso wrote:
Hmm... I think that takes the discussion to another level, and the
question is:
"what does a capture returns when coerced to a context it doesn't
provide a value for?"
I'd like to take one step further, and ask what it is that introduced
capture semantics in the first place. And I suggest that the answer
should be "the use of a signature"
I'd also suggest that we get rid of the use of backslash as a
capture-creation operator (the signature of Capture::new can do that)
and instead re-task it as a "signature" creation operator.
If we do that, then I think we can reduce the discussion of the
semantics of multi-returns to the semantics of assignments:
If the sub/method defines a return-signature then that is used (with
standard binding semantics), otherwise the result is semantically a flat
list.
If the LHS is an assignment is a signature, then the rhs is matched to it:
my (@a, %b) = 1,2,3, b => 4; ## everything in @a; %b empty
my \(@a, %b) = 1,2,3, b => 4; ## @a = 1,2,3; %b = (b=>4)
If the rhs is the result of a return from a function that has no
return-signature, then the same semantics would apply