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 <[email protected]> wrote:
> On Wed 25 Jun 2014 15:19, Andy Wingo <[email protected]> writes:
>
> > Hi,
> >
> > On Fri 20 Jun 2014 15:16, "Mark S. Miller" <[email protected]> writes:
> >
> >> On Fri, Jun 20, 2014 at 1:48 AM, Andy Wingo <[email protected]> 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
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss