ES3.1 Object static methods rationale document
liorean
liorean at gmail.com
Thu Jul 17 10:39:18 PDT 2008
2008/7/16 Allen Wirfs-Brock <Allen.Wirfs-Brock at microsoft.com>:
> I've up loaded to the wiki a new document titled: "Proposed ECMAScript 3.1
> Static Object Functions: Use Cases and Rationale"
I've got one objection to Object.getPrototypeOf: It allows inspection
and modification of prototype chains established like this:
function F(){}
/* add some prototype properties here */
newObj=new F;
F.prototype={constructor:F};
In ES3.0, this allows you to create unexposed and protected prototype
chains. There's no way to recover newObj.[[Prototype]] once
F.prototype has been changed in ES3.0 code. Granted, I've never seen
this pattern used in production code except incidentally, but it's a
guarantee that ES3.0 does have nonetheless and I could see myself
using it if I really wanted to protect an object's prototype from
being modified.
--
David "liorean" Andersson
More information about the Es4-discuss
mailing list