[Harmony Proxies] Proposal: Property fixing

Mark S. Miller erights at google.com
Thu May 12 17:11:23 PDT 2011

On Thu, May 12, 2011 at 4:20 PM, Cameron McCormack <cam at mcc.id.au> wrote:

> Tom Van Cutsem:
> > invariants that are enforced:
>> > - unconfigurable [[Class]] (Object or Function, respectively)
> Web IDL requires [[Class]] to take on values other than these two, for
> example it should be "HTMLDivElement" for an HTMLDivElement object.  I
> have a feeling that the web requires this, as opposed to just having a
> custom toString function.
> http://google.com/codesearch?q=Object.prototype.toString.call+lang:javascript
> brings up some libraries that use Object.prototype.toString on DOM
> objects.
> Is it palatable to have proxies control [[Class]] or is there another
> way we can help proxies over this hurdle?

Tom and I actually proposed this at an earlier EcmaScript meeting, for
precisely this reason. Discussion revealed difficulties that led to
increasing complexity, due to the use of [[Class]] as an internal nominal
type test within the specification machinery. For example, all the Date
methods implicitly test that their this.[[Class]] is "Date":

    > a TypeError exception is thrown if the this value is not an
    > object for which the value of the [[Class]] internal property is

Do we want a proxy to be able to pass this test? If so, do we want a proxy
to be able to provide the internal properties that the Date methods access?
At the time at least, the proposal for [[Class]] control went down in flames
as such questions accumulated. In light of Allen's recent thinking about
meta-objects and reflection, we can certainly revisit this, but please not
at the May meeting ;).

> --
> Cameron McCormack ≝ http://mcc.id.au/
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110512/bf0369a1/attachment.html>

More information about the es-discuss mailing list