On Wed, Sep 9, 2009 at 1:28 PM, Will Coleda<[email protected]> wrote: > Again, this doesn't work if someone is passing you a PMC; you'll have > to introspect the type (dangerous, subclasses) or the 'does' (useless, > both types claim to do array). Is there another way to distinguish > these two types of aggregates?
You're right, we do need a good way to distinguish. The way I see it, we have two options: 1) Create a second type of role that does what you are talking about 2) Merge the Fixed* and Resizable* PMC types together. > I would be interested to see the performance timings for things as > they stand. I would be (pleasantly) surprised if indexed access is > faster for fixed. I can tell you that there will be a performance win using the Fixed*Array variants, although I suspect that those differences will be small. > If the performance only is slow when using push and friends, but still > fast when doing indexed access I don't see the problem here. It's probably not a big difference in these cases, no. So you might be better off using the Resizable*Array variants for everything. > This also brings up a related note, that 'elements' behaves > differently across these 2 array types (one returning storage size, > one returning max(highest used element,storage size)). This is another > case where these types should either work similarly (so that when you > pass an array around you can use it without having to check which kind > of aggregate you have), or have a clear way to distinguish between the > two. Agreed. Once we have concensus about which one to use we can apply it to both. --Andrew Whitworth _______________________________________________ http://lists.parrot.org/mailman/listinfo/parrot-dev
