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

Lazy interface objects?

From: David Flanagan <dflanagan@mozilla.com>
Date: Tue, 20 Sep 2011 21:48:05 -0700
Message-ID: <4E796C85.4010008@mozilla.com>
To: public-script-coord@w3.org
When an specification, such as HTML, defines many IDL interfaces, 
implementors are naturally tempted to create the interface objects 
lazily so that they are only initialized when first used.

One way to do that is to define an interface object property (such as 
the HTMLHeadingElement property of the Window object) using a getter 
which when invoked, initializes the HTMLHeadingElement interface object, 
converts the property to a data property with that object as its value 
and returns the object.

Unfortunately, the first paragraph of WebIDL 4.5 requires an interface 
object property to be [[Writable]]: true.  Thus, it seems that using a 
getter for the property would not conform.  Can the spec be relaxed on 
this point?  It seems that the relevant detail is that the property can 
be set: that it should be a writable data property or a accessor 
property with a setter.

(Thanks to David Bruant for pointing this out.  See 
https://bugzilla.mozilla.org/show_bug.cgi?id=687042 for context.)

     David Flanagan
Received on Wednesday, 21 September 2011 04:48:44 UTC

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