> It should pass them on to the PMC directly, which
> should then handle  them properly.

Let me rephrase.  How should the PerlArray pmc handle
negative indecis when the absolute value of the index
is greater than the size of the array.  Here are some
examples:
#first set up an array
 new P0, .Perl Array
 set P0, 3

 set P0[0], 1
 set P0[1], 2
 set P0[2], 3
#now, what do these accesses produce?
P0[-1] => P0[2] => 3
P0[-3] => P0[0] => 1
P0[-5] => ?
here's my take on how to DTRT
-5 + 3 = -2, -2 + 3 = 1, so
P0[-5] => P0[1] => 2

Like I said in the earlier message, this would only
need the 'if's changed to 'while's to work.  But,
right now the PerlArray.pmc code does this:

if (ix < 0) ix += SELF->cache.int_val

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.

cheers,
Stephen Rawls

__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com

Reply via email to