Duplicate property names (was Re: @@new)

Mark S. Miller erights at google.com
Fri Jun 20 06:16:30 PDT 2014


Yes, good catch. This is a change, and it is now allowed.


On Fri, Jun 20, 2014 at 1:48 AM, Andy Wingo <wingo at igalia.com> wrote:

> On Thu 19 Jun 2014 18:02, "Mark S. Miller" <erights at google.com> writes:
>
> > Yes. For both strict and sloppy, for both static/literal and
> > dynamic/computed, duplicate property names/symbols in object literals
> > are no longer an error. Instead, in left-to-right order, each cause the
> > equivalent of a [[DefineOwnProperty]] on the new object, so that
> > rightward definitions silently overwrite conflicting leftward
> > definitions. This should not result in any change to sloppy literals. It
> > just makes strict literals, regarding this issue alone, act like sloppy
> > literals. (Once we have a way to express that a property is to be
> > initialized to a non-configurable state, we'll need to revisit this. But
> > that's after ES6.)
>
> There is one change:
>
>   ({ foo: 3, get foo() { return 4 } })
>
> This is not allowed with current sloppy mode.  Are you proposing that it
> be allowed, given that this situation may arise with computed property
> names:
>
>   ({ ['foo']: 3, get foo() { return 4 } })
>
> or
>
>   ({ foo: 3, get ['foo']() { return 4 } })
>
> Andy
>



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


More information about the es-discuss mailing list