W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2014

Re: Exposing constructors of readonly interfaces to web authors

From: Rik Cabanier <cabanier@gmail.com>
Date: Sun, 29 Jun 2014 22:38:10 -0700
Message-ID: <CAGN7qDBH5yE6Ur62a83KbwHV5dryAzkLNzXs=Z+sd2ujgvXfWw@mail.gmail.com>
To: Domenic Denicola <domenic@domenicdenicola.com>
Cc: Brendan Eich <brendan@secure.meer.net>, Dirk Schulze <dschulze@adobe.com>, Anne van Kesteren <annevk@annevk.nl>, "public-script-coord@w3.org" <public-script-coord@w3.org>
On Sat, Jun 28, 2014 at 12:32 PM, Domenic Denicola <
domenic@domenicdenicola.com> wrote:

> From: Rik Cabanier [mailto:cabanier@gmail.com]
>
> > Can't we change the code so it always returns the same getters? ie
> instead of creating a new {} and getter function, keep a reference of them
> in the object and use them in Object.defineProperty. That way the object's
> prototype will always have the same getters and it won't be very costly to
> implement.
>
> You cannot. (Try it! Please, try everything you are suggesting in an
> actual browser!) In your example, the getters close over the variables in
> the DOMQuad() closure (which is no longer a constructor, BTW, and thus
> should be lowercased: domQuad()). You need separate getters for each
> instance of the closure, since each instance of the closure creates a new
> rect variable.
>

o yes. I forgot that they would become closures.
Given this, can you ever use attributes in JS object and have them return
the same getter function?
Can we ever use attributes in the DOM? Also, who relies on them being the
same? That seems like a strange assumption.
Received on Monday, 30 June 2014 05:38:37 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:22 UTC