News for hackers. Stuff that matters.
Re:JavaScript Temporal Is Coming by ivanjermakov on Thursday January 30, 2025 @09:40PM (#42884258)
Because it is impossible in JS? Except some crazy hacks, similar to how Java's constant string pool works, where every used object is a reference to a value in a pool of all objects.
Re:JavaScript Temporal Is Coming by jdkoeck on Friday January 31, 2025 @02:02AM (#42885276)
I wouldn’t call this a particularly crazy hack, it’s also called string interning and I reckon that’s what every language runtime does when strings are immutable (which includes javascript runtimes, also this isn’t required by the language specification).
Re:JavaScript Temporal Is Coming by nikeee on Wednesday February 05, 2025 @09:20PM (#42958221)
There is the record and tuple proposal. If we'd have methods on records (currently not part of the spec) this would be trivial.