<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>Il giorno 30/mar/2011, alle ore 20.59, Jonathan Sauer ha scritto:</div><blockquote type="cite"><div><font class="Apple-style-span"><br></font>One one hand, it seems simple: Just transform a lambda into a local struct, turn captured variables into<br>attributes and initialize them in the local struct's constructor. Finally create an anonymous instance of<br>this struct and use it in place of the lambda (a bit like it is described here:<br><<a href="http://stackoverflow.com/questions/3218821/c0x-lambda-overhead">http://stackoverflow.com/questions/3218821/c0x-lambda-overhead</a>>).<br><br></div></blockquote><div>Yes, this is the main idea, and also the main attractive power of C++ lambdas when compared</div><div>with other languages: there's no runtime overhead.</div><br><blockquote type="cite"><div>(just ignore interaction with ObjC blocks. They are too different from each other)<font class="Apple-style-span"><font class="Apple-style-span" color="#144FAE"><br></font></font></div></blockquote>The semantics of the two are very incompatible, especially regarding object lifetime issues.</div><div>However, someone expressed in the past the need for them to be at least partially compatible</div><div>(for example, being able to pass a lambda where a block is expected), so I think it is at least</div><div>worth thinking about it.</div><div><br><blockquote type="cite"><div>On the other hand, clang is a really complex system, and C++ is a grotesquely complicated language, so<br>the integration of lambdas into the compiler will be a lot more difficult than the simple transformation<br>I outlined above. Therefore I wonder if you will have enough time to complete your implementation,<br>especially if you're not proficient in clang. OTOH, IMO even a partial, but working and well-documented<br>implementation still is better than none.<br></div></blockquote><div><br></div><div>I think that with a fair amount of help from my mentor and the other members of the community I will</div><div>be able to complete the job. Also, this will be my thesis work, so I should receive support from my</div><div>thesis relator here at the university.</div><br><blockquote type="cite"><div><br>Finally, when I read your first announcement on this list, I was very excited, because although I realized<br>that other C++0x features such as rvalue references were far more needed than lambdas (they are, after all,<br>"just" syntactic sugar), they are still useful (but why, oh why couldn't they be polymorphic?).<br><br>So I say: Go for it! :-)<br><br></div></blockquote><div><br></div><div>This positive opinion is very good news for me. Thank you :)</div><div><br></div><div>Anybody else has comments or suggestions about the proposal? If you think it's good enough</div><div>I'll submit it to melange in the next days.</div><br><blockquote type="cite"><div><br>Jonathan<br></div></blockquote><div><br></div>Bye,</div><div>Nicola</div><div><br></div></div></body></html>