Proxying built-ins (Was: [[Invoke]] and implicit method calls)
allen at wirfs-brock.com
Wed Sep 25 09:04:01 PDT 2013
On Sep 25, 2013, at 6:49 AM, Mark S. Miller wrote:
> Why does Date need private state? AFAICT, it only needs uniquely named state. Why not do what we've done for many other bits of internal state that doesn't need to be private: just name it with a unique symbol? This doesn't work for all internal state of course, but it does seem it would work for Date.
Mostly, because that is its legacy definition and changing it would be observably different is various ways.
But more importantly, Date in these examples is just an exemplar of any object that has internal state or identify dependencies. For example, I suspect you wouldn't propose using a unique symbol keyed property to access the internal state of a Map.
More information about the es-discuss