On Mon, Sep 7, 2009 at 19:08, Jonathan Leto<[email protected]> wrote:
> Howdy,
>
> Should one be able to push up to a fixed number of elements onto a
> FixedPMCArray?

Now, I realize that I may be newish here, so forgive me if I'm talking
completely out of my ass, but to me the idea of pushing/popping or
shifting/unshifting a Fixed anything seems like it's just
inappropriate; the very notion of these operations implies a change in
the size of the Array.

Is there a good reason to not just use keyed set?

> For example, should the following code put a number in the first slot of $P0?
>
> new $P0, 'FixedPMCArray'
> $P0 = 5
> push $P0, 42

I'm guessing that from your text above, you intend the implementation
to permit exactly five pushes before... what? An exception is thrown?
You'd need to track how far things have been pushed, and maybe even
the "has_been_set" status of every element.

What happens in the following situation?

new $P0, 'FixedPMCArray'
$P0 = 5
$P0[2] = 1
push $P0, 2
push $P0, 3
push $P0, 4

And are you going to do all of push/pop/shift/unshift? Then you'd need
to track from both sides, in interesting ways. (How would successive
pops even be handled if you're not removing things?)

I'm just not convinced that these operations make any sort of sense in
the context of a Fixed-size Array.

-- treed
_______________________________________________
http://lists.parrot.org/mailman/listinfo/parrot-dev

Reply via email to