On 4/10/15 4:26 PM, smaug wrote:
I'd say that is rather painful for reviewers, since both Move() (I
prefer .swap()) and lambda hide what is actually happening to the refcnt.
Wanna ban copy construction? ;)
Higher-level constructs inherently "hide" something, but I disagree they
make things harder to understand and read, quite the opposite.
And nsRefPtr's copy constructor is probably the safest part of that class.
So easy to forget to use nsCOMPtr explicitly there.
We should emphasize easy-to-read-and-understand code over fast-to-write.
I agree with your emphasis, however I draw the opposite conclusion.
The death to readability is the boilerplate that lambdas replace IMHO.
I find our existing runnable code hard to reason about because I have to
jump between indirections to lots of disjunct classes, just to follow
the flow of code, not to mention all the boiler plate needed simply to
pass values forward.
I find a parallel here with callbacks vs promises in JavaScript. The
Promise chaining pattern relies on inline function definitions to make
the flow of code match the flow of reading, making it easier to reason
about and review.
.: Jan-Ivar :.
-Olli
- Seth
_______________________________________________
dev-platform mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-platform