At 10:13 AM -0800 1/28/03, Michael Lazzaro wrote:
>OK, here are the answers so far -- or more accurately, strawman
>interpretations of those answers that should be objected to if
>they're wrong.
I think some of this is incorrect which, because Damian thinks
otherwise, will need some hashing out from Larry on how he wants perl
arrays to behave. Because...
>1) Edge cases in array indexing:
>
> my int @a = (1,2,3);
>
> @a[3] # undef (warning: index out-of-bounds)
Or a real 0, since you said @a can only return integers.
> @a[2**128] # EXCEPTION: index is above max allowed index
Except we can manage this internally, so I don't know that it's a problem
> @a[ Inf ] # undef (warning: can't use Inf as array index)
I'd throw an exception here.
> @a[-4] # undef (warning: index out-of-bounds)
> @a[-Inf] # undef (warning: can't use Inf as array index)
Or zero, since it's an int array.
>2) There is a platform-dependent maximum array size, ((2**32)-1 for
>32-bit platforms.) Attempting to access an index outside that range
>throws an exception. Note that this applies to both 'real' and
>'sparse' arrays.
But since we've got big(int|float|rat)s there's no real reason for
that to be a problem. If you want to use 10**100**100 as an array
index, you could just throw an awful lot of memory at us...
--
Dan
--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
dan@sidhe.org have teddy bears and even
teddy bears get drunk