>>>  nsCOMPtr<nsIFoo> foo;
>>>  int32_t f = foo->GetFoo();
>>>
>> Why was I expecting this to be Foo()? (Perhaps unreasonably.)
>
> Yeah, it should be Foo().
> File a bug?

I considered Foo(), but my concern was that, when we extend this to
attributes which return interfaces (e.g. nsIFoo), then Foo() versus
GetFoo() has a particular meaning (in parts of our code): Foo() must
never return null.  But I was expecting that an infallible attribute
could correctly return null.

We can tweak this: attributes which return primitives are always
Foo(), and attributes which return interfaces are GetFoo() unless we
also have [nevernull] on the attribute.  I'm not sure if the
complexity there is worth the cost.

>>> I rejected the first approach because it meant that every call to GetFoo
>>> from XPCOM would need to go through two virtual calls: GetFoo(int32_t*) and
>>> then GetFoo().
>>>
>> And also because MSVC would have messed up the vtable.
>>
>
> _______________________________________________
> dev-platform mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-platform
_______________________________________________
dev-platform mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to