Em Qua, 2009-03-04 às 20:21 +0100, pugs-comm...@feather.perl6.nl escreveu: > Simplify meaning of Capture and Match in item context to preserve sanity > (an object in item context is always just itself, never a subpart)
sub foo { return 1 } my $a = foo(); That is currently expressed as taking the capture (in this case \(1)) and coerce it to the appropriate context, in order for that to work, Capture need to do some DWIMmery when used in item context. What I have in mind is: A capture in item context returns the first positional argument if there is only one (named or positional), otherwise it returns itself (so it can be used as both an array and a hash). > The invocant (if any) of a Capture is now always considered 1st positional. Unless you're a method, then it's really an invocant... That seems to mean that you actually have two different APIs to talk to a capture, which are: * I don't care about invocant, gimme the positional args * I do care about invocant, gimme the positional args So, if you don't care about invocant, it is just a regular positional argument, but if you do care, it is not a positional argument. It looks like the old "my $self = shift"... What really got me confused is that I don't see what problem this change solves, since it doesn't seem that a signature that expects an invocant (i.e.: cares about invocant) will accept a call without an invocant, so "method foo($b,$c) is export" still need to have a transformed signature in the sub version of foo. daniel