`Object.freeze` do not solve the issue with WeakMap, right?
( http://wiki.ecmascript.org/doku.php?id=strawman:value_objects )
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss
Salvador de la Puente González wrote:
var tuple = Object.freeze([1, 2]);
Right, and #[1, 2] could transpile and give nice, compact syntax.
Too bad I put the comma operator in JS from day 1 -- Java did not but I
followed C, the great grand-parent.
/be
@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()
I'm not an expert but the JIT could keep all the lists as tuples until a
modification is performed and then prevent further optimisation.
I don't know if current JITs are already doing this way.
On 10 Sep 2014 23:42, Jeremy Martin jmar...@gmail.com wrote:
Michal - Why have it only throw in
See https://brendaneich.com/2011/01/harmony-of-my-dreams/ tuples --
much of the rest is in ES6 or out of date (e.g. = functions supersede
#(){}), but tuples and records might still happen, based on my spider-sense.
/be
___
es-discuss mailing list
Did I say a nonsense about JIT and lists? Indeed, AFAIK, making:
var tuple = Object.freeze([1, 2]);
It is like having a tuple and the JIT could realize the object is frozen
and perform the required optimizations.
On Thu, Sep 11, 2014 at 7:28 PM, Brendan Eich bren...@mozilla.org wrote:
See
Should we have new type - tuples?
My proposal:
- Tuples are immutable.
Eg.
var wow = new Tuple('my', 'little', 'Cthulhu');
wow[2] = 'Nyarlathotep'; // throws in strict mode, silently fails in sloppy mode
- Tuples are primitive type. Comparison between tuples is based on
identity of elements, not
Why would tuples be any more memory efficient than objects or arrays?
On 10 Sep 2014 11:57, Michał Wadas michalwa...@gmail.com wrote:
Should we have new type - tuples?
My proposal:
- Tuples are immutable.
Eg.
var wow = new Tuple('my', 'little', 'Cthulhu');
wow[2] = 'Nyarlathotep'; //
Michal - Why have it only throw in strict mode? Tuples would be a new
construct, so no breaking of the web if it throws in all contexts.
Jasper - It's not necessarily a given, but the immutability of tuples
offers some guarantees that are easier to optimize against. E.g., no need
to pre-allocate
9 matches
Mail list logo