Re: Proposal About Private Symbol

2014-12-21 Thread Kevin Smith
> > ```js > var constructor=function(){ > 'use strict'; > var allObjects=new WeakSet(); > var privateSymbol=Symbol('private', true); > var ret=function(){ > if(this===undefined)throw Error('Invalid Construction'); > this[privateSymbol]=1; > allObjects.add(thi

RE: Proposal About Private Symbol

2014-12-21 Thread Domenic Denicola
That breaks membranes. From: Gary Guo<mailto:nbdd0...@hotmail.com> Sent: ‎2014-‎12-‎21 20:00 To: Domenic Denicola<mailto:d...@domenic.me> Cc: es-discuss@mozilla.org<mailto:es-discuss@mozilla.org> Subject: RE: Proposal About Private Symbol I di

RE: Proposal About Private Symbol

2014-12-21 Thread Gary Guo
e symbols > From: d...@domenic.me > To: waldron.r...@gmail.com; nbdd0...@hotmail.com; es-discuss@mozilla.org > Subject: RE: Proposal About Private Symbol > Date: Sat, 20 Dec 2014 20:11:04 + > > For more reasons on why a simple "private symbol" approach does not

RE: Proposal About Private Symbol

2014-12-21 Thread Domenic Denicola
Subject: RE: Proposal About Private Symbol Oops, I forget the WeakSet. So seems my private symbol proposal can work now. Under very deliberately design, private symbol can be used as private field. ```js var constructor=function(){ 'use strict'; var allObjects=new WeakSet(

RE: Proposal About Private Symbol

2014-12-21 Thread Gary Guo
Oops, I forget the WeakSet. So seems my private symbol proposal can work now. Under very deliberately design, private symbol can be used as private field. ```jsvar constructor=function(){'use strict';var allObjects=new WeakSet();var privateSymbol=Symbol('private', true);var ret=fu

RE: Proposal About Private Symbol

2014-12-21 Thread Michał Wadas
> But this is not the core of the problem. The problem is the Proxy introduced in ES6 enables an object to capture and override almost any operation on an object. Without operation on object, it becomes very costly (by using an Array of created objects and compare each of them) to identify whether

RE: Proposal About Private Symbol

2014-12-21 Thread Gary Guo
> From: jackalm...@gmail.com > Date: Sun, 21 Dec 2014 00:45:40 -0800> > There are ways around this, too - create your own Symbol, keep it > closure-private to the class, so it doesn't escape the class's > methods. Have the constructor take an extra argument that must be > equal to this symbol; if

Re: Proposal About Private Symbol

2014-12-21 Thread Tab Atkins Jr.
On Sat, Dec 20, 2014 at 10:41 PM, Gary Guo wrote: > Oops, mistakes found. I just ignored the fact that in this particular way the > Symbol can be retrieved. It seems impossible to have an idea of private > symbol in this way. In the case, I think the language can provide a way to > distinguish

RE: Proposal About Private Symbol

2014-12-20 Thread Gary Guo
Error('Invalid This');         this[sym]=1;     }     return ret.bind(undefined); }(); ``` > From: nbdd0...@hotmail.com > To: es-discuss@mozilla.org > Subject: RE: Proposal About Private Symbol > Date: Sun, 21 Dec 2014 12:08:09 +0800 > >

RE: Proposal About Private Symbol

2014-12-20 Thread Gary Guo
('id')]!=identifier)throw Error('Invalid This');         this[sym]=1;     }     return ret.bind(undefined); }(); ``` ________ > Date: Sat, 20 Dec 2014 22:48:37 -0500 > Subject: Re: Proposal About Private Symbol > From: zenpars...@gmail.com &

Re: Proposal About Private Symbol

2014-12-20 Thread Kevin Smith
> > >2. They would not invoke any traps on proxies. > >3. They would not tunnel through proxies to proxy targets. > >4. Getting a private-symbol-keyed property would not traverse the > prototype chain of the object (perhaps arguable). > Unnecessary, as long as symbol doesn't leak to external enviro

Re: Proposal About Private Symbol

2014-12-20 Thread Kevin Smith
> > > Under careful use of the symbols, and without Object.getOwnPropertySymbols > leaking every symbol, we can use symbols as private field. > There are other ways that symbols can leak besides `getOwnPropertySymbols`. Take a look at proxies, which allow you to intercept [[Get]] and [[Set]]. In

RE: Proposal About Private Symbol

2014-12-20 Thread Gary Guo
onstraints I did not see any problems there. >From: d...@domenic.me >To: nbdd0...@hotmail.com; es-discuss@mozilla.org >Subject: RE: Proposal About Private Symbol >Date: Sun, 21 Dec 2014 02:58:15 + > >Did you read the linked post? The problem is completely differe

RE: Proposal About Private Symbol

2014-12-20 Thread Domenic Denicola
zilla.org> Subject: RE: Proposal About Private Symbol Oops, seems Outlook.com ruins my email. One more time I don't think it's a problem though. As long as the private Symbol doesn't leak, there is no way to access private properties. Private Symbol as I supposed

RE: Proposal About Private Symbol

2014-12-20 Thread Gary Guo
e Symbol (just one more boolean field when defining the struct symbol) though it is not exposed to Script-side. > From: d...@domenic.me > To: waldron.r...@gmail.com; nbdd0...@hotmail.com; es-discuss@mozilla.org > Subject: RE: Proposal About Priva

RE: Proposal About Private Symbol

2014-12-20 Thread Gary Guo
defining the struct symbol) though it is not exposed to Script-side.> From: d...@domenic.me> To: waldron.r...@gmail.com; nbdd0...@hotmail.com; es-discuss@mozilla.org> Subject: RE: Proposal About Private Symbol> Date: Sat, 20 Dec 2014 20:11:04 +>> For

RE: Proposal About Private Symbol

2014-12-20 Thread Domenic Denicola
For more reasons on why a simple "private symbol" approach does not quite work, see https://github.com/zenparsing/es-abstract-refs/issues/11#issuecomment-65723350 ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-d

Re: Proposal About Private Symbol

2014-12-20 Thread Rick Waldron
On Sat Dec 20 2014 at 7:54:19 AM Gary Guo wrote: > I have just sent this proposal through > http://www.ecma-international.org/memento/register_TC39_Royalty_Free_Task_Group.php > but > I don't know what more I need to do. I am a high school student from China > who is interested in next-generatio