On Wed, Aug 19, 2009 at 04:54:10AM -0700, Moritz Lenz via RT wrote: > On Wed Apr 08 14:59:19 2009, moritz wrote: > > 23:55 <@moritz_> rakudo: my @a = 1..4; say @a[1..*].perl > > 23:56 < p6eval> rakudo 6b9755: OUTPUT«[2, 3, 4, undef]» > > > > It should just be [2, 3, 4]. > > Since the discussion came up on #perl6 if this is really the expected > behaviour, S09 says: > > As the end-point of a range, a lone "whatever" means "to the maximum > specified index" (if fixed indices were defined): > > say @calendar[5..*]; # Same as: say @calendar[5..11] > say @calendar{Jun..*}; # Same as: say @calendar{Jun..Dec} > > or "to the largest allocated index" (if there are no fixed indices): > > say @data[1..*]; # Same as: say @results[1..5] > > > It doesn't mention how the postcifcumfix:<[ ]> is supposed to introspect > those to find out if the WhateverCode object constructed by 1..* needs > to receive self.elems or self.elems-1 as an argument.
The short answer is that 1..* isn't a WhateverCode object, it's a Range with a Whatever endpoint. (Rakudo currently gets this wrong, yes.) So postcircumfix:<[ ]> then changes its dispatch based on having a Range argument. Pm