On 06/02/2025 20:48, o...@ocs.cz wrote:
P.S. Besides, a decent implementation of size-extend in case of too big gaps should automatically switch the underlying implementation to a sparse list, of which the programmer does not need to be expliticly aware :)

This would e.g. mean that index access would no longer be constant time for this collection going forward, so I would 100% not want for this to happen automatically.

P.P.S. I've tried array.withDefault and found it is not supported, and one is forced to uglies like “(arr as List).withDefault...”. That's one thing I would add; could hardly break any current code I'd say?

I agree that array support in Groovy could in principle use some love: I e.g. tried to use arrays in cases where the number of elements would always remain constant years back in our framework, but then eventually just switched to using immutable Groovy array lists instead, since it was so much more convenient.

Cheers,
mg


Reply via email to