Duplicate property names (was Re: @@new)
Andy Wingo
wingo at igalia.com
Fri Jun 20 01:48:27 PDT 2014
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
More information about the es-discuss
mailing list