A read/write __proto__ that can vanish

Allen Wirfs-Brock Allen.Wirfs-Brock at microsoft.com
Wed Jul 16 11:46:55 PDT 2008


Personally, I don't that the internal [[Prototype]] "property" should reify as an actual property of the object.  It's really a more fundamental aspect of "objectness" than regular properties.  From that perspective, if you want to control access to it, it should probably be done as a flag on the object itself, much as the ES3.1 proposal does with the [[Extensible]] property.


-----Original Message-----
From: es4-discuss-bounces at mozilla.org [mailto:es4-discuss-bounces at mozilla.org] On Behalf Of Ingvar von Schoultz
Sent: Wednesday, July 16, 2008 10:29 AM
To: es3.x-discuss at mozilla.org; es4-discuss at mozilla.org
Subject: A read/write __proto__ that can vanish

Some people yearn hotly for __proto__, preferrably writable if
at all possible, while others point to problems with security
and software privacy.

I get the impression that this could be solved by adding a fourth
flag among the property flags Enumerable, Writable and Flexible.
There might be a flag called Visible, so you could make __proto__
apparently vanish by setting Visible to false.

As an added bonus, this solution would let code hide the prototype
property on constructors if desired.

Personally I'd love to see it defined in such a way that I could
set prototype inheritance in a simple, straightforward way at the
beginning of a constructor function:

     function $MyConstructor()
     {  this.proto = MySuperInstance;
         // Here you can hide proto if desired.
         ...
     }

If a visible proto is standardized, the name should be proto, not
__proto__, in my opinion. The underscores indicate nonstandard.

--
Ingvar von Schoultz

------- (My quirky use of capitals in code comes from my opinion that
reserved and predefined words should all start with lowercase, and
user-defined should all start with uppercase, because this will easily
and elegantly prevent a host of name-collision problems when things
like programming languages are upgraded with new labels.)
_______________________________________________
Es4-discuss mailing list
Es4-discuss at mozilla.org
https://mail.mozilla.org/listinfo/es4-discuss




More information about the Es4-discuss mailing list