3 ms·
We’ve had Map with those semantics since 2014, came out in Chrome a few months before Set. Record/Tuple objects are immutable primitives with structural equali
by jitl 2y ago
We’ve had Map with those semantics since 2014, came out in Chrome a few months before Set.
Record/Tuple objects are immutable primitives with structural equality, not object reference equality. So little relation to AS3 Dictionary/ES6 Map, besides being possible keys for Map/Set.
- klabb3 2y ago> Record/Tuple objects are immutable primitives with structural equality TIL and also god that would be amazing, almost to the point of making JS/TS actually nice if done right (what’s next, pattern matching?). The number one footgun in JS imo is the combination of mutability and reference copying. Immutable or at least easy-to-copy plain old data is fantastic when it is well supported in the language.
- for1nner 2y ago> what’s next, pattern matching? Oh boy do I have news for you... https://tc39.es/proposal-pattern-matching/ https://tc39.es/proposal-pattern-matching/ :P