Hi, As smop and mildew now support ControlExceptionReturn (see v6/mildew/t/return_function.t), an important question raised:
sub plural { return 1,2 } sub singular { return 1 } my @a = plural(); my $b = plural(); my @c = singular(); my $d = singular(); What should @a, $b, @c and $d contain? Note that the spec says explicitly that a Capture should be returned, delaying the context at which the value will be used, this allows sub named { return :x<1> } my $x := |(named); So, this also means that assigning my @a = plural(); my @c = singular(); forces list context in the capture, which should return all positional parameters, as expected. But my $b = plural(); my $d = singular(); would force item context in the capture, and here is the problem, as a capture in item context was supposed to return the invocant. I think this means we should change this bit of the spec, so that a capture in item context return the first positional argument if there is only one positional argument or a list coerced to item of all the named arguments. This would mean that $b in the above code would contain [1,2] while $d would contain simply 1. It's important to realize that this is different from p5 because the argument list to return is not flattened, this means that return @a will always return a list, even if @a has only one element, because as @a is not flattened, it is still a list inside the capture, and when that capture is used in item context, it will assign that list in item context. The same way that return 1,; is always always a list, because you have more than one positional argument. What do you think? daniel