Mark S. Miller (2015-04-30T17:17:04.000Z)
d at domenic.me (2015-05-11T16:55:37.376Z)
This must *not* be hung off of Object.freeze. Object.freeze is about tamper proofing an object's API, not about making its internal state immutable. I regret the term "freeze" for this purpose as it repeatedly suggests this confusion. OTOH, because of the override mistake, Object.freeze is not directly usable as a good tamper proofing operation, so in this sense it was fortuitously good that it did not use up the name tamperProof. Deep immutability is a crucial concept deserving of good support for many reasons including security patterns. Deep immutability must of course include encapsulated state captured by lexical closures, and it must do so without violating the security properties that this very encapsulation guarantees. The Auditors of E (http://www.erights.org/elang/kernel/auditors/, http://wiki.erights.org/wiki/Guard-based_auditing) and Joe-E (http://www.cs.berkeley.edu/~daw/papers/pure-ccs08.pdf, http://www.eecs.berkeley.edu/Pubs/TechRpts/2012/EECS-2012-244.html) provided solutions to this dilemma in their respective languages. E and Joe-E also support shallower forms of immutability that are specific to collections -- that are distinct from API tamper proofing but that do not extend to considering the mutability of the contents of the collections. I welcome proposals that would make sense for JavaScript.