On 12 Aug 2009, at 19:00, Allen Wirfs-Brock wrote:
I'm quite certain that non-enumerable is what is most commonly
desired for such method properties. Readonly-ness is certainly more
debatable. I'm pretty sure that most programmer, most of the time,
when they define a "method" are not doing so with the expectation
that it will be dynamically replaced. However, there is also power
that comes for the ability to arbitrarily "patch" other people's
objects and I know that some members of the JavaScript community are
worried about web applications becoming too brittle if various
mechanisms to "freeze" objects are overused. From that perspective
giving "method" properties the attributes {enumerable: false,
writable: false, configurable: true} may be a better compromise
between programmer intent and excessive brittleness than
{enumerable: false, writable: false, configurable: false} that is
currently in the strawman proposal.
What's difference in behaviour does { configurable: true, writable:
false } give versus { configurable: true, writable: true }? Is it that
you'd have to delete the property and recreate it or change it with
Object.defineProperty?
At any rate I think the perl motto of "you say out of someone else's
living room because they ask you to, not because they have a shotgun"
applies here. If someone wants to monkey patch a method on another
object they better make sure they know what they are doing.
-ash
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss