[cfe-dev] objc++ enhancements for new c++ features

James Gregurich via cfe-dev cfe-dev at lists.llvm.org
Wed Mar 28 14:55:17 PDT 2018



> On Mar 28, 2018, at 4:29 PM, John McCall <rjmccall at apple.com> wrote:
> 
> There is no existing concept of a move-only block.  That is just not how blocks work.
> Just add __block to the declaration of tmp1.


one cannot use __block with lambda syntax. One would have to give up lambda syntax. lambda syntax is preferable to blocks syntax because the explicit captures make for more understandable and configurable code. its much easier for a reader of code to reason upon what is going on in code with no non-obvious implicit activity happening as often happens with blocks syntax. we've had serious bugs that caused production hassles because objc pointers got implicitly and cyclically retained in a block capture. lambda syntax eliminates such bugs.

btw. I realize that "isn't how blocks work" currently... I'm inquiring about the potential of making it more friendly to the c++ way of doing things. Again, my purpose is to improve the experience of the c++ programmer doing cocoa development.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180328/b5a277aa/attachment.html>


More information about the cfe-dev mailing list