On Jun 25, 2014, at 10:27 AM, Erik Arvidsson wrote:

> Allen,
> 
> > If propKey is the string value "__proto__"
> 
> Do we want to allow "__\u0070roto__" or not? For "use strict" we made it 
> clear that no escape sequences are allowed. I think we should follow that 
> route unless it makes implementation and/or speccing too hard.

I think the usual rules should apply.  LiteralPropertyName is either an 
IdentifierName or a StringLiteral.  
http://people.mozilla.org/~jorendorff/es6-draft.html#sec-names-and-keywords 
says the escaped and non-escaped code points are equivalent within an 
IdentifierName.  
http://people.mozilla.org/~jorendorff/es6-draft.html#sec-static-semantics-sv-s-and-cv-s
 says the the SV of is the same for a string containing non-escaped code points 
and a string containing escapes for the same code points.

That means that {__proto__: something}, {__\u0070roto__: something}, 
{"__proto__": something}, and {"__\u0070__": something} should all mean the 
same thing and if Annex B is being implemented that means they all do a 
[[SetPrototypeOf]].

I think "use strict" is a special care where we were trying to simulate what we 
would allow in a statement composed of reserved words and escapes are now 
allowed in keywords. 
http://people.mozilla.org/~jorendorff/es6-draft.html#sec-reserved-words 

Allen








> 
> 
> On Wed, Jun 25, 2014 at 11:21 AM, Allen Wirfs-Brock <al...@wirfs-brock.com> 
> wrote:
> yes, this is covered by 
> http://people.mozilla.org/~jorendorff/es6-draft.html#sec-__proto__-property-names-in-object-initializers
>  
> 
> __proto__ only has special meaning within a production:
> 
>   PropertyDefiniton : PropertyName ":" AssignmentExpression
> 
> and when PropertyName is not a ComputedPropertyName.
> 
> All other PropertyDefinition forms that have __proto__ as the property name 
> (whether literally or as a ComputedPropertyName)  just define ordinary 
> properties with the name "__proto__".
> 
> The current non-duplicated name restriction made it illegal to have more than 
> one __proto__ : something property definitions in an object literal. Because 
> __proto__: something is a special form with its own semantics I think we 
> should continue to make it illegal to have more than one of them, even when 
> we relax the duplicate rule for regular property definitions.
> 
> Allen
> 
> 
> On Jun 25, 2014, at 8:09 AM, Erik Arvidsson wrote:
> 
>> If I recall correctly the intent was that __proto__ was special syntax for 
>> setting the [[Prototype]]. So only three following cases are setting the 
>> [[Prototype]]
>> 
>> {__proto__: object}
>> {'__proto__': object}
>> {"__proto__": object}
>> 
>> Other combinations set an own property:
>> 
>> {['__proto__']: object}
>> {'__\u0070roto__]: object}
>> {__proto__() {}}
>> var __proto__;
>> {__proto__}
>> {get __proto__() {}}
>> {set __proto__(x) {}}
>> 
>> Combining these leads to confusing code (so don't do that) but the semantics 
>> is clear.
>> 
>> 
>> On Wed, Jun 25, 2014 at 9:27 AM, Andy Wingo <wi...@igalia.com> wrote:
>> On Wed 25 Jun 2014 15:19, Andy Wingo <wi...@igalia.com> writes:
>> 
>> > Hi,
>> >
>> > On Fri 20 Jun 2014 15:16, "Mark S. Miller" <erig...@google.com> writes:
>> >
>> >> On Fri, Jun 20, 2014 at 1:48 AM, Andy Wingo <wi...@igalia.com> wrote:
>> >> >
>> >> >     There is one change:
>> >> >
>> >> >     ({ foo: 3, get foo() { return 4 } })
>> >> >
>> >>     This is not allowed with current sloppy mode.
>> >>
>> >> Yes, good catch. This is a change, and it is now allowed.
>> >
>> > What about:
>> >
>> >   ({ get __proto__() {}, __proto__: foo })  // (1)
>> >
>> > Does this end up setting the prototype of the result?  Would it if there
>> > were a setter?
>> >
>> > Likewise:
>> >
>> >   ({ __proto__: foo, get __proto__() {} })  // (2)
>> >
>> > This one is kinda similar:
>> >
>> >   ({ ['__proto__']: 34, __proto__: foo })   // (3)
>> 
>> And another one:
>> 
>>   ({ get __proto__() {}, __proto__: foo, set __proto__(x) {} })
>> 
>> Does the resulting accessor have a setter and a getter, or just a
>> setter?  I would think just a setter, in the same way that this one
>> would only have a setter:
>> 
>>   ({ get qux() {}, qux: foo, set qux(x) {} })
>> 
>> Andy
>> 
>> 
>> 
>> -- 
>> erik
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss@mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
> 
> 
> 
> 
> -- 
> erik

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to