On 09/18/2013 10:55 PM, Luke Wagner wrote:
To save typing, the JS engine has typedefs like typedef Handle<JSObject*>
HandleObject; typedef Rooted<JS::Value> RootedValue; and the official
style is to prefer the HandleX/RootedX typedefs when there is no need to use the
Handle<X>/Rooted<X> template-ids directly.
This issue was discussed off and on in the JS engine for months, leading to a
m.d.t.js-engine.internals newsgroup thread
(https://groups.google.com/forum/#!topic/mozilla.dev.tech.js-engine.internals/meWx5yxofYw)
where it was discussed more (the high occurrence of
Handle/Rooted in the JS engine combined with the relatively insignificant
difference between the two syntactic forms making a perfect bike shed
storm).
Given that the JS engine has the official style of "use the typedefs", it seems
like a shame for Gecko to use a different style; while the
difference may be insignificant, we do strive for consistency. So, can we
agree to use the typedefs all over Gecko? From the
m.d.t.js-engine.internals thread I think bholley of the kingdom of XPConnect is
strongly in favor.
I don't care too much whether we use Handle/Rooted<Foo> or typedefs but
consistency is always good.
(And except in WebIDL bindings and in XPConnect we should try to use JSAPI
manually a little as possible.
Bindings should hide JSAPI usage.)
-Olli
(Again, this doesn't have to be an absolute rule, the needs of meta-programming
and code-generators can override.)
Cheers, Luke
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform