Strawman: Tuples

Michał Wadas michalwadas at gmail.com
Thu Sep 11 03:53:01 PDT 2014


@Jasper: because tuples can be insanely optimized - their immutability
(including fixed length) removes almost any overhead (JS objects
overhead is quite big). Of course, modern engines can optimize array
to be

@Jeremy: consistency with other immutable primitives and frozen objects.
`(function() {
'wow'[0]='a';
})() // undefined, silently fails
(function() {
'use strict';
'wow'[0]='a';
})(); //TypeError: 0 is read-only
(function() {
'use strict';
Object.freeze({'oh': 'hai'})).oh = 'Cthulhu';
})(); // TypeError: "oh" is read-only
(function() {
Object.freeze({'oh': 'hai'})).oh = 'Cthulhu';
})(); // undefined, silently fails
`


More information about the es-discuss mailing list