Some questions about Private Name Objects

Matthew Robb matthewwrobb at gmail.com
Mon Aug 27 08:04:38 PDT 2012


AH okay thanks guys, questions answered!

On Mon, Aug 27, 2012 at 11:03 AM, Axel Rauschmayer <axel at rauschma.de> wrote:

>
> On Aug 27, 2012, at 16:55 , Matthew Robb <matthewwrobb at gmail.com> wrote:
>
> SO it has to be constructed via new Name() or will it automatically create
> Name objects when it encounters an assignment of that form? If you do have
> to create it does that mean in order to access it at all you would need to
> be in scope of myname2?
>
> My question I think boils down to whether access is SCOPE gated or OBJECT
> gated:
>
> var myClass = (function(){
>   class myClass {
>     constructor(){
>       this[test] = 0;
>     }
>   }
>
>   return myClass;
> })()
>
> myClass.prototype.getTest = function() {  return this[test]  }
>
> Is the above perfectly valid?
>
>
> No, ES.next would complain about the undeclared variable `test` (variable
> scope, not object). The closest you can get to simulating is by using
> strings with UUIDs. That avoids the name clashes, but doesn’t hide the
> properties.
>
>         --
> Dr. Axel Rauschmayer
> axel at rauschma.de
>
> home: rauschma.de
> twitter: twitter.com/rauschma
> blog: 2ality.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120827/ead67e91/attachment-0001.html>


More information about the es-discuss mailing list