On 08/29/2012 10:20 PM, Boris Zbarsky wrote:
Right now, attribute getters always get prefixed with "Get" in the
WebIDL bindings.  So "readonly attribute long foo" becomes "int32_t
GetFoo()" in the C++.

Would it make sense to drop the Get in certain cases?  In particular, in
cases in which:

1)  The getter is infallible.
2)  The return value is not returned via an outparam.
3)  The return value is not an interface type or is not nullable.

So this IDL:

   readonly attribute long foo;
   readonly attribute Iface bar;
   readonly attribute Iface? baz;

would become:

   int32_t Foo();
   already_AddRefed<Iface> Bar();
   already_AddRefed<Iface> GetBaz();

(with Iface* instead in cases when the getter is not an addreffing getter).

Thoughts?

It certainly looks nicer, but I'm not a big fan of complicating the rules for assembling the C++ signature from the WebIDL. XPIDL's consistency here, IMO, saves time when implementing an interface: you can focus on the actual implementation, rather than the binding code.

HTH
Ms2ger

_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to