News for hackers. Stuff that matters.
Re:JavaScript Temporal Is Coming by noduerme on Thursday January 30, 2025 @07:35AM (#42877175)
Records.. Wasn't Dictionary an ECMA5 proposal or was that just a novel touch in AS3?

[edit: For those who don't know, Dictionary was a type in AS3 that let you use any object reference or string or number as a unique key, with any type of value attached. Garbage collection worked around this so it wasn't a weak reference as long as the dictionary object itself was alive. Think of a Javascript Set except with strongly typed keys of any kind you specified. Errors thrown at compile time. God..I miss that language.]

Re:JavaScript Temporal Is Coming by jitl on Thursday January 30, 2025 @07:45AM (#42877224)
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.

Re:JavaScript Temporal Is Coming by klabb3 on Thursday January 30, 2025 @08:35AM (#42877523)
> 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.

Re:JavaScript Temporal Is Coming by for1nner on Thursday January 30, 2025 @10:59AM (#42878956)
> what’s next, pattern matching?

Oh boy do I have news for you... https://tc39.es/proposal-pattern-matching/

:P