- From: Robin Berjon <robin@robineko.com>
- Date: Tue, 1 Dec 2009 15:27:03 +0100
- To: Dominique Hazael-Massieux <dom@w3.org>
- Cc: "richard.tibbett" <richard.tibbett@orange-ftgroup.com>, public-device-apis <public-device-apis@w3.org>
On Dec 1, 2009, at 09:24 , Dominique Hazael-Massieux wrote: > Le lundi 30 novembre 2009 à 18:26 +0100, Robin Berjon a écrit : >> Actually, it could work without an interface (and whenever we can do >> without these we should — keep in mind that they pollute the global >> namespace). We could just have: >> >> var c = myContacts.add({ name: "Pink Unicorn", urls: >> ["http://shiny-donkey.com/"]}); >> >> The object that is passed is essentially treated as a Contact object — >> there is no need to create it. Functionally we get the same thing, >> without pollution. It's much cleaner. > > I agree it is cleaner, but I only see working it out for relatively > simple and flat structures — given that the currently proposed Contact > object has sub-structures, and a fairly large number of fields, I’m not > sure it’s entirely realistic. That's true, I'm just looking for ways to avoid global constructors if at all possible. > I guess the factory method could take a single parameter for the name > (since that’s currently the only required attribute), and let the others > be completed through attributes setting. Yes, that's one option that I think would work. -- Robin Berjon robineko — hired gun, higher standards http://robineko.com/
Received on Tuesday, 1 December 2009 14:27:38 UTC