On the wiki, I've posted a new strawman Private Name proposal 
http://wiki.ecmascript.org/doku.php?id=strawman:private_names . It replaces 
Dave and Sam's original Names strawman and was developed in consultation with 
them. This is a significant revision to the original proposal but builds upon 
some of the same base ideas. 

In reading this strawman it's important to understand that its concept of 
"private" is quite different from what you may be use to from C++ or Java.   In 
those languages "private" is an attribute of a member (field or method) of an 
class.  It means that the member is only accessible to other members of the 
same class (ignoring what can be done via reflection).  This model is not a 
particularly good match to the JavaScript object model where the structure of 
an object is much more dynamic and method functions can be dynamically 
associated or disassociated with an object and shared by many different kinds 
of objects.

In this proposal, "private" is an attribute of a property name, rather than of 
an actual property.  Any code that has access to a "private name" can use that 
name to create or access a property of any object. It is accessibility to the 
name that is controlled rather than accessibility to the property.  This seems 
to fit more naturally with JavaScript's dynamic object construction patterns 
and without really changing the fundamental JavaScript object model it enables 
JavaScript programmers to create a number of different information hiding 
abstractions.

Please read the proposal and let's start the discussion.

Allen



_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to