On 1/7/2014 12:58 PM, Benoit Jacob wrote:
I would like a random voice in favor of deprecating NS_ENSURE_* for the reason that hiding control flow behind macros is IMO one of the most evil usage patterns of macros.

In general, I would agree. I have no problems with killing, say, NS_ENSURE_TRUE or similar macros. However, NS_ENSURE_SUCCESS is a special case: it is the equivalent in JS of not providing a try/catch statement around a JS expression. In code that makes extremely heavy use of XPCOM requirements, NS_ENSURE_SUCCESS brings the amount of boilerplate needed to one line per function; to not use it requires significantly more boilerplate (three lines, if you insist on following the always-brace-ifs convention).

--
Joshua Cranmer
Thunderbird and DXR developer
Source code archæologist

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

Reply via email to