Safety: A comparaison between Rust, C++ and Go
Disingenuous.<p>The bad C++ code is in the very first line of the &quot;make_appender&quot; definition: capturing the closure&#x27;s environment by reference is nonsense: It is equivalent to returning a reference to an argument. It is not, then, a closure at all.<p>Using a correctly-defined make_appender would not, then, produce undefined behavior when you use it, with or without &quot;move&quot;.<p>What the author has done here was to take a too-obviously wrong operation, returning a reference to an argument, but dress it up with syntax that will look less familiar to some readers, and pass it off as insightful.<p>But using a wrong function and getting wrong results is not surprising.<p>Piling on more uses after, that give more wrong results, does not reveal anything more.<p>When you need disingenuous arguments to make your point, it tells us more about your point than about the thing you are trying to make a point about. And, publishing anyway tells us more about you.<p>Returning that fake closure should evoke a compiler warning, if you turn on warnings.