Re:Lambda expression comparison between C++11, C++14 and C++17
by user982 on Saturday May 14, 2016 @08:10PM
(#11698659)
Apple extended C with block closures years ago.
The declaration for lambda variables is almost identical to function pointers, just with a ^ instead of a *, so there's nothing to learn (or unlearn, like C++ forces you to). The ^ looks like a lambda, and historically the lambda of lambda calculus actually was a caret accent over the variable. The argument list can be elided.
[ Parent
| on HN ]
Re:Lambda expression comparison between C++11, C++14 and C++17
by anon946 on Saturday May 14, 2016 @08:49PM
(#11698777)
Looking here (https://developer.apple.com/library/ios/documentation/Cocoa/...) for the details, I think this is going to largely be a matter of opinion. I prefer the C++ syntax, especially when it comes to capture by reference, for which the Apple syntax seems to require the __block storage type modifier.
Re:Lambda expression comparison between C++11, C++14 and C++17
by CJefferson on Sunday May 15, 2016 @03:26AM
(#11699892)
And this is why C++ couldn't use this notation, as they didn't want to break compability with this extension of Apple's.
Re:Lambda expression comparison between C++11, C++14 and C++17
by fanf2 on Monday May 16, 2016 @03:34AM
(#11704827)
Caret as the embryonic form of lambda is apparently a myth propagated by Barendregt, and lambda is just a random Greek letter to go with alpha, beta, and eta.
http://researchblogs.cs.bham.ac.uk/thelablunch/2016/05/why-i...