Frozen Date objects?

Erik Arvidsson erik.arvidsson at gmail.com
Wed Jul 17 13:07:57 PDT 2013


Exposing [[DateValue]] as a property does not really scale. What about
[[MapData]]? What about private state stored in a closure or a
WeakMap?

This can either be done by exposing an object that has the same
interface as Date. This could throw on set or it could skip the set
methods entirely. If you want instanceof to work then all the methods
needs to be overridden.

On Wed, Jul 17, 2013 at 3:54 PM, Domenic Denicola
<domenic at domenicdenicola.com> wrote:
> From: Domenic Denicola [domenic at domenicdenicola.com]
>
>> This seems like it would be a backward-compatible change.
>
> Well, OK, this is actually just false: code that previously did `Object.freeze(dateObj); dateObj.setDays(3);` would no longer work as expected. I guess that might kill this idea?
>
> Or can we hope that few enough people are freezing dates that this is an allowable break in backward-compat?
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss



-- 
erik


More information about the es-discuss mailing list