Re: Mixing nsresult and Result code

2017-05-10 Thread Kris Maglione
On Tue, May 09, 2017 at 12:50:26PM +, Nicolas B. Pierron wrote: On 05/07/2017 07:34 PM, Kris Maglione wrote: static inline Result WrapNSResult(PRStatus aRv) { if (aRv != PR_SUCCESS) { return Err(NS_ERROR_FAILURE); } return Ok(); } static inline

Re: Mixing nsresult and Result code

2017-05-09 Thread Nicolas B. Pierron
On 05/07/2017 07:34 PM, Kris Maglione wrote: static inline Result WrapNSResult(PRStatus aRv) { if (aRv != PR_SUCCESS) { return Err(NS_ERROR_FAILURE); } return Ok(); } static inline Result WrapNSResult(nsresult aRv) { if

Re: Mixing nsresult and Result code

2017-05-08 Thread Michael Layzell
I also don't like the NS_TRY name, it seems too close to MOZ_TRY. I would prefer to avoid names which are identical except s/NS/MOZ/. Perhaps NSRESULT_TRY would be a better name? It makes it clear that it is performing the try against the nsresult type. On Mon, May 8, 2017 at 10:17 AM, Ehsan

Re: Mixing nsresult and Result code

2017-05-08 Thread Ehsan Akhgari
I think these seem like valuable additions to nscore.h. It would be helpful to extend these facilities that would allow more code to use the Result-based programming model. (I'm not too much of a fan of the NS_TRY name, but can't think of a better name myself... :/ ) On 05/07/2017 03:34

Mixing nsresult and Result code

2017-05-07 Thread Kris Maglione
I've been trying to write most of my new code to use Result.h as much as possible. When I have to mix Result-based code with nsresult-based code, though, things tend to get ugly, and I wind up writing helpers. At this point I've wound up writing the same helpers in 3 or 4 different places, so