W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2011

RE: Lazy interface objects?

From: Travis Leithead <Travis.Leithead@microsoft.com>
Date: Wed, 21 Sep 2011 22:34:10 +0000
To: David Flanagan <dflanagan@mozilla.com>, Jonas Sicking <jonas@sicking.cc>
CC: "public-script-coord@w3.org" <public-script-coord@w3.org>
Message-ID: <9768D477C67135458BF978A45BCF9B3834CE1448@TK5EX14MBXW604.wingroup.windeploy.ntdev.microsoft.com>
>From: David Flanagan [mailto:dflanagan@mozilla.com]
>I wonder if the ES3 requirement of [[Writable]] properties was
>reconsidered during the development of ES5 and the addition of
>Object.defineProperty and Object.getOwnPropertyDescriptor()?  In ES3
>implementations that supported getters and setters, the choice between a
>data property and an accessor property was an implementation detail.
>When ES5 added getOwnPropertyDescriptor(), that implementation detail
>became observable, and the meaning of a [[Writable]]:true requirement
>changed from a behavior to be tested (can I set the property?) to an
>attribute to be queried (what does getOwnPropertyDescriptor() return?).
>Was there an explicit intent there to restrict the choices available to
>implementors?  If not, then maybe the ES spec should be relaxed in the
>same way that I'm proposing that WebIDL should be relaxed.  (Though I
>don't think the case for relaxing ES is as strong).

If I recall my conversations with Allen correctly, it was indeed something that was considered. I believe compatibility was favored at the time over change to lock them down.


>In general, it seems to me that defineProperty and
>getOwnPropertyDescriptor are reflection and metaprogramming tools that
>intentionally enable unsafe observation of implementation details.  It
>is a mistake, I think, to use them as a specification mechanism.  (The
>same thing goes for getPrototypeOf)

Yes, defineProperty and getOwnPropertyDescriptor are "reflection" based tools; but I disagree with your sentiment of them being "unsafe". I believe they add a deeper level of implementation specificity that web developers should be able to rely on--indeed we've already started to see some convergence among different browsers in this area.
Received on Wednesday, 21 September 2011 22:34:51 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:04 UTC