On Thu, Aug 01, 2002 at 05:42:12PM -0400, Dan Sugalski wrote: > At 10:24 PM +0100 8/1/02, Graham Barr wrote: > >On Thu, Aug 01, 2002 at 02:11:27PM -0700, Stephen Rawls wrote: > >> > It should pass them on to the PMC directly, which > >> > should then handle them properly. > >> > >> So, if ix < -SELF->cache.int_val then the code tries > >> to use a negative value to access the array element in > >> the C code. This is obviously wrong. My question is > >> should this raise an internal exception, or should > >> there be some DWIMery inside PerlArray.pmc. > > > >Well in perl today. > > > > print $a[-2]; > > > >just gives undef and @a is unchanged > > > > $a[-2] = 1; > > > >dies with > > > >Modification of non-creatable array value attempted, subscript -2 at > >-e line 1. > > > >But it seems to me that parrot has not concept of lvalue/rvalue use > >when fetching an element from an aggregate. > > Not with fetching, no.
Hm, That may result in arrays being extended unnecessarily, which would also be a change in semantics, or array access for rvalues being multiple ops, checking the array length first. > The second example would be something like: > > set P0[-2], 1 > > in assembly. Right, which would raise an exception if the array had less than 2 elements. Graham.