logoalt Hacker News

procaryoteyesterday at 7:01 PM1 replyview on HN

There's a lot wrong with Javascript's Date, but the fact that it's an object is is not really in the top 10.

Would it have been nice if the Date object had been immutable? Sure, but the fact that changing the mutable object does indeed change the object shouldn't be a shock


Replies

chowellsyesterday at 9:32 PM

It's definitely a shock when something else changes the date object you've been holding on to. The problem with mutable values has never been when you (that is, the local context) change them. It's always that you can't trust that nothing else (some very non-local code) does.