- From: Dominique Hazael-Massieux <dom@w3.org>
- Date: Tue, 01 Dec 2009 09:24:22 +0100
- To: Robin Berjon <robin@robineko.com>
- Cc: "richard.tibbett" <richard.tibbett@orange-ftgroup.com>, public-device-apis <public-device-apis@w3.org>
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. 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. Dom
Received on Tuesday, 1 December 2009 08:24:50 UTC