Lazy interface objects?

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