Re: Contacts API -- [NoInterfaceObject]

Hi Andreas,

On Aug 24, 2011, at 09:53 , Andreas Gal wrote:
> Can someone explain to me why all the classes in the Contacts API are marked [NoInterfaceObject]?
> This seems pretty non-standard behavior (most of the DOM doesn't behave like this).

I wouldn't work with the assumption that the DOM is necessarily the reference when it comes to API design. Large tracts of it seem to have considered JS as an afterthought (if at all) and it is formalised using OMG IDL instead of WebIDL  I'm not eve sure that the former supports a mechanism for NoInterfaceObject.

The idea behind using NoInterfaceObject is to avoid global namespace pollution unless there happens to be a good use case for exposing a given object (which there may well be, it might simply not have been suggested yet). We're clearly not the only ones using this approach:

> It breaks instanceof checks, and defeats extensibility (using expandos) via a shared prototype.

My understanding is that instanceof is too unreliable due to cross-context issues and that expandos on host objects were strongly discouraged (I certainly have been avoiding both). That being said, this is naturally open to discussion.

Robin Berjon - - @robinberjon

Received on Wednesday, 24 August 2011 12:55:27 UTC