It wouldn't be too hard to automatically generate Result<T, nsresult> wrapper methods automatically for all of our XPIDL interfaces. I had a prototype branch at one point which did this on the rust side, as part of my now-dead rust XPIDL bindings.
That would convert a good number of our fallable calls to using Result<T, nsresult>. We might even be able to look into doing something similar with our WebIDL bindings and ErrorResult. On Fri, Jan 20, 2017 at 8:59 AM, Ted Mielczarek <t...@mielczarek.org> wrote: > On Fri, Jan 20, 2017, at 08:19 AM, Nicolas B. Pierron wrote: > > > The Rust case is helped by the fact that `Result` is the defacto type > > > for returning success or error, and it's effectively `must_use`. We > > > don't have a similar default convention in C++. > > > > We have > > > > http://searchfox.org/mozilla-central/rev/30fcf167af036aeddf322de44a2fad > d370acfd2f/mfbt/Result.h#173 > > > > we just have to make it the default convention now. > > Yes, and this is great, I just meant that in Rust 99% of code that's > returning success/failure is using `Result` because it's in the standard > library, whereas in C++ there's not an equivalent. `mozilla::Result` is > great and I hope we can convert lots of Gecko code to use it, but we > have *a lot* of Gecko code that's not already there. > > -Ted > _______________________________________________ > dev-platform mailing list > dev-platform@lists.mozilla.org > https://lists.mozilla.org/listinfo/dev-platform > _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform