On Mon, Nov 28, 2011 at 9:51 PM, Allen Wirfs-Brock <[email protected]>wrote:
[...]
> it is better to consistently reuse an existing policy than to make up a
> new policy for each new situation.
>
For me, this is the overriding consideration. ES5 defines two ways to set a
property: assignment and Object.defineProperty. Both have a complex set of
rules that need to be learned. Arguably some of these rules are
non-sensical[1], but they are now in stone. Given that we introduce new
syntax for setting properties, I strongly prefer that their semantics
simply be one of these two, even if suboptimal for the use case expected of
this new syntax, rather than invent yet a third set of rules for developers
to learn.
That said, because of the similarity of ".{" to object literals, I think
their semantics should simply be defined in the obvious way in terms of
Object.defineProperty.
[1] I have come to hate the rule that you can't override an inherited
non-writable data property by assignment. But I believe leaving this
mistake alone is better than the consequences of any attempt to fix it.
--
Cheers,
--MarkM
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss