Private symbols vs property attributes

Mark Miller erights at gmail.com
Sun Feb 10 10:40:23 PST 2013


How does this interact with Proxies[1]? I know the answer probably starts
with "whitelist", but let's spell it out in this context, and test it
against the 8 membrane transparency cases previously discussed. If there
are good answers for all of these, and if we can reuse enumerable: for this
purpose as Brendan suggests, then I'm guardedly positive. I do not want to
introduce a new attribute.

[1] For now, I agree that the proxies we should examine are direct proxies.


On Sun, Feb 10, 2013 at 9:30 AM, David Bruant <bruant.d at gmail.com> wrote:

> Le 10/02/2013 17:16, Mark S. Miller a écrit :
>
>  I do not understand what is being proposed. When I try to imagine a
>> proposal starting from what has been said, I have not been able to imagine
>> something that works. But that's not a criticism. What is this alternate
>> privacy idea?
>>
> My understanding is:
> * there is only one kind of symbol
> * whether the symbol is reflected by Object.getOwnPropertyNames and the
> likes is controlled by a 'private' attribute in property descriptors.
>
>     // unique constructor, no boolean since there is only one kind of
> symbol
>     var s = new Symbol();
>     var o = {}, o2 = {};
>
>     Object.defineProperty(o, s, {value: 12, private: true});
>     assert(Object.**getOwnPropertyNames(o).length === 0)
>     assert(o[s] === 12);
>     o[s] = 31;
>     assert(o[s] === 31);
>
>     Object.defineProperty(o2, s, {value: 7, private: false});
>     assert(Object.**getOwnPropertyNames(o)[0] === s);
>     assert(o2[s] === 7);
>     o2[s] = 13;
>     assert(o2[s] === 13);
>
> Pending question:
>     var o3 = {};
>     o3[s] = 62;
>     Object.**getOwnPropertyDescriptor(o3, s).private // true or false?
>
> Since private:false implies symbol sharing through Object.**getOwnPropertyDescriptor,
> I think private:true should be favored to force people to be explicit (see
> my reply to Brendan)
>
> The main difference with the current proposal is that privacy isn't an
> inherent characteristic of the symbol, but related to how it's been
> configured on the different objects it's been used on.
>
> Was the above one of the things you imagined? If yes, why doesn't it work?
>
> David
>
> ______________________________**_________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/**listinfo/es-discuss<https://mail.mozilla.org/listinfo/es-discuss>
>



-- 
Text by me above is hereby placed in the public domain

  Cheers,
  --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130210/6cdcbda6/attachment-0001.html>


More information about the es-discuss mailing list