Proposal: Large arrays (original) (raw)

Reinier Zwitserloot reinier at zwitserloot.com
Tue Mar 24 18:25:17 PDT 2009


Far too cute; I think:

fooArray.add(foo);

is superior to all of:

fooArray[fooArray.length] = foo; fooList += foo; fooList -= foo;

Note also that fooArray[length+1] can't be made threadsafe, and the
pseudo-addition/substraction is exactly the kind of example people who
oppose operator overloading use - it's that offensive to some.

Access and setting is a decent addition, but not something I usually
do with my lists (I iterate them instead). I'd use comprehensions
more. Not against it either, just saying 'meh' to the idea.

--Reinier Zwitserloot

On Mar 24, 2009, at 23:20, Mark Mahieu wrote:

2009/3/24 Joe Darcy <Joe.Darcy at sun.com>

... which is generally why I favor letting collection-like types use the bracket notation to get and set elements. +1 That would eliminate the syntactically advantages of arrays. Except, possibly, for 'adding' elements to them, which in many cases just looks like: fooArray[i++] = foo; Collections could conceivably go even cuter though: fooList += foo; and fooList -= foo; Mark



More information about the coin-dev mailing list