Re: [contacts] Comments on editors draft of Contacts API

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:
> [""]});
> 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.


Received on Tuesday, 1 December 2009 08:24:50 UTC