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

RE: [webidl] Defining constructors on non-global objects?

From: Domenic Denicola <domenic@domenicdenicola.com>
Date: Fri, 5 Sep 2014 14:00:37 +0000
To: Boris Zbarsky <bzbarsky@mit.edu>, "public-script-coord@w3.org" <public-script-coord@w3.org>
Message-ID: <7318bebf37284616bf68ee6386afafee@BN1PR05MB325.namprd05.prod.outlook.com>
From: Boris Zbarsky [mailto:bzbarsky@mit.edu] 

> If this is the API you want, then for the moment you can define an AmbientLight factory method that returns an object of the right type, and the "new" call above will work due to how "new" works in JS.  But the returned object won't be instanceof Sensor.AmbientLight, and won't have Sensor.AmbientLight as its .constructor

I think it would be better not to do that. The approach I would take is, make up a fictitious syntax for now (we can brainstorm on that if you'd like) and we will be sure to get it into WebIDL before your spec needs to ship.

Because I am passionate about not letting WebIDL restrict good design, I personally will volunteer to do the work of speccing this for you. Although that will be dependent on implementer consensus, as such a change to IDL's capabilities would need to be reflected in their code generators... :-/

That said, what does the Sensor constructor do by itself?
Received on Friday, 5 September 2014 14:01:09 UTC

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