Uninteresting parameters
Brendan Eich
brendan at mozilla.com
Tue Sep 27 13:57:21 PDT 2011
On Sep 27, 2011, at 1:21 PM, Dean Landolt wrote:
> Out of curiosity is there any reason to keep holes the holes around in ObjectLiteral and ArrayLiteral?
No holes in ObjectLiteral.
It's true for ES6, opt-in only, we could change ArrayLiteral to remove holes. This would make early errors for code migrating into ES6 that uses holes, and for authors writing fresh ES6 programs who use holes.
(Note well that [1,] is an array of length 1, no holes.)
> Is there a real usecase (other than rare and trivial minification wins)? Sure, it would be a breaking syntax change but statically detectable and correctable. And it would wipe out a source of bugs rather than doubling down.
What bugs have you seen due to holes in literas? I've never seen or heard of any such bugs. The possibility of holes exists without literal syntax support, due to the ability to add elements to an array by assignment to non-contiguous indexes, delete elements, and set length.
I don't see how to get rid of holes created via these means without making runtime-only, not early, errors -- and that's too big a migration tax. It's a source of new bugs that we could avoid by not trying to ban holes.
So, if we still have holes, is it really worth getting rid of ArrayLiteral support for them? I think not.
BTW, I proposed, as part of Harmony of My Dreams, tuples: http://wiki.ecmascript.org/doku.php?id=strawman:tuples -- no holes, immutable, sane enumeration. Not in Harmony yet.
/be
More information about the es-discuss
mailing list