Duplicate property names (was Re: @@new)
Erik Arvidsson
erik.arvidsson at gmail.com
Wed Jun 25 08:09:39 PDT 2014
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 <wingo at igalia.com> wrote:
> On Wed 25 Jun 2014 15:19, Andy Wingo <wingo at igalia.com> writes:
>
> > Hi,
> >
> > On Fri 20 Jun 2014 15:16, "Mark S. Miller" <erights at google.com> writes:
> >
> >> On Fri, Jun 20, 2014 at 1:48 AM, Andy Wingo <wingo at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140625/b1172a58/attachment.html>
More information about the es-discuss
mailing list