Tab Atkins Jr. wrote:
On Tue, May 29, 2012 at 9:26 AM, Nicholas C. Zakas
<[email protected]> wrote:
Thanks for the clarifications. I understand wanting to make the distinction
from an implementer point of view, I'm just not sure that developers make
the distinction between [[Put]] and [[DefineOwnProperty]] even using regular
object literals. Is there a reason that this:
var obj = {};
obj.{
name: "JS"
};
Can't act the same as this:
var obj = {};
obj.name = "JS";
You forget the
obj.{
conciseMethod() {},
get x() {},
set x(v) {}
}
probably. Or you want the special case for prop:value?
Wherein, if the property is already defined that acts as [[Put]] and
otherwise acts as [[DefineOwnProperty]]?
Same thoughts here. Regular devs (like me!) only see
[[DefineOwnProperty]] when creating a literal, and then there's no
observable distinction between these two in normal circumstances:
var obj = { foo: bar }
var obj = {};
obj.foo = bar;
I don't think it's worth optimizing for the [[DefineOwnProperty]]
case. We should just use the standard "foo:bar" syntax, and have it
invoke [[Put]] behavior.
As written, the strawman's attachment of the more natural "foo:bar"
syntax for [[DefineOwnProperty]] is a footgun.
~TJ
Herby
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss