Re: partial interfaces, [NoInterfaceObject]

I think there's no noticable difference from the web authors point of
view as long as there's no APIs which take a NavigatorGeolocation
object as a parameter.

There is a bit of a difference implementation wise. Normally a "Foo
implements NavigatorGeolocation" requires the implementation to carry
around additional metadata so that it knows that it can pass Foo
instances to APIs that take a NavigatorGeolocation parameter. I don't
know how high that cost is.

However if the implementation has enough smarts that it knows that
there are no APIs that take a NavigatorGeolocation parameter, then it
could optimize that metadata away. I don't know if there are
implementations that do that. I don't think Gecko makes such
optimizations.

There's also a cost for implementations and authors that read the spec
that there are additional interfaces to juggle. I.e. when you see the
"interface NavigatorGeolocation { ... }", you have to remember (or
look up) that there's a "Navigator implements NavigatorGeolocation" to
know that that API appears on the navigator object. I.e. the
"implements" add an extra level of indirection which complicates the
mental model.

/ Jonas

On Fri, Feb 14, 2014 at 11:29 AM, Ian Hickson <ian@hixie.ch> wrote:
> On Fri, 14 Feb 2014, Boris Zbarsky wrote:
>> On 2/14/14 12:51 PM, Ian Hickson wrote:
>> > These are black-box indistinguishable, as far as I understand.
>>
>> That .... depends.  If there's a method around that takes a
>> NavigatorGeolocation parameter, that's a reasonable thing to do with the
>> "implements" approach but not the partial interface approach.
>
> Sure. I'm talking exclusively about the [NoInterfaceObject] case, though,
> where you can't get hold of the interface object because it's just mushed
> into the thing that implements it, as if it was partial.
>
> --
> Ian Hickson               U+1047E                )\._.,--....,'``.    fL
> http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
> Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
>

Received on Friday, 14 February 2014 19:42:13 UTC