On 2009-Aug-19, at 8:07 am, Jon Lang wrote:
On Wed, Aug 19, 2009 at 5:37 AM, Jan Ingvoldstad<frett...@gmail.com> wrote:
On Wed, Aug 19, 2009 at 1:54 PM, Moritz Lenz via RT <perl6-bugs-follo...@perl.org > wrote:
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 * can tell when it's in a range, and set some range-flag on the resulting object, right? Then .[] will test for $whatever.range- flag. Or am I missing the point?

Given that it's relatively easy to say "1..^*", I wouldn't mind
standardizing this so that '*' always refers to the element just past
the last one, at least when dealing with the standard index.

I like the DWIMmery, but the more I think about it, for such a little difference, it seems more worthwhile to be consistent than to be DWIMy. So, yes, either * always means last+1, and use 1..^*, or make * mean the last index, and use [*+1] to append.

But there is a problem with sparse arrays, isn't there?

Sparseness is an implementation detail. Arrays all look the same to the user; sparseness just means perl is smart enough to do @foo[10000000000000000]=$bar without trying to suck up a zillobyte of RAM.


-David

Reply via email to