News for hackers. Stuff that matters.
Re:JavaScript Temporal Is Coming by rimunroe on Thursday January 30, 2025 @01:47PM (#42880800)
Records and tuples are unlikely to ever ship, or at least are extremely unlikely to ship with the semantics around equality people want. My understanding is that browser vendors already have pretty strong opposition to introducing new primitives at this point. Reading this thread[1] will give some explanation as to the hiccups with how equality would behave. It sucks, because while I wouldn't have expected BigInt to have gotten much adoption in the first place, I constantly run into cases where I'd want collections with structural equality.

Additionally, my understanding is that the opposition to adding new primitives also affects pattern matching, though I'm not sure why. I'm much less up to date on that proposal.

[1] https://github.com/tc39/proposal-record-tuple/issues/387

Re:JavaScript Temporal Is Coming by pspeter3 on Thursday January 30, 2025 @06:55PM (#42883461)
That's a bummer. I wish there was a way to use non primitive objects in Maps & Sets more effectively then. Perhaps a well known Symbol for hashCode or something.
Re:JavaScript Temporal Is Coming by int_19h on Thursday January 30, 2025 @11:10PM (#42884625)
To be honest, this reads kind of insane, and reminds me of how wasm was at least partially designed around V8 idiosyncrasies and limitations.
Re:JavaScript Temporal Is Coming by rimunroe on Friday January 31, 2025 @08:33AM (#42887464)
> To be honest, this reads kind of insane

Could you clarify which part you’re referring to? I’m disappointed at them feeling trepidation after BigInt, but the thread I linked (and some other discussions I’ve seen) make me understand why they’d choose to focus effort elsewhere.

It would be a monumental change and it’s not entirely clear how much of the community outside the React and similar ecosystems would adopt it. It might have significant performance issues for the desired use cases and choices about value semantics would affect usability.

Re:JavaScript Temporal Is Coming by theplatman on Thursday January 30, 2025 @11:35PM (#42884725)
BigInt shipped because financial organizations needed it for certain applications.
Re:JavaScript Temporal Is Coming by rimunroe on Friday January 31, 2025 @08:26AM (#42887411)
I know why people needed it. It’s obviously useful. However, it’s still a relatively niche use case and rarely encounter people using it, especially compared to how many people I encounter asking about dealing with compound keys in maps or how to deeply compare two static blobs of JSON-style data. I understand why the implementers felt burned by its lack of adoption given its burden of implementation, but I’m also a bit surprised they expected more use.