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

RE: Exposing constructors of readonly interfaces to web authors

From: Domenic Denicola <domenic@domenicdenicola.com>
Date: Sat, 28 Jun 2014 19:32:06 +0000
To: Rik Cabanier <cabanier@gmail.com>, Brendan Eich <brendan@secure.meer.net>
CC: Dirk Schulze <dschulze@adobe.com>, Anne van Kesteren <annevk@annevk.nl>, "public-script-coord@w3.org" <public-script-coord@w3.org>
Message-ID: <dd33c2ad6dbe4c8fb8062fb20fc0ef69@DM2PR05MB336.namprd05.prod.outlook.com>
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.
Received on Saturday, 28 June 2014 19:32:39 UTC

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