5db26a83   
   From: mordor.nospam@fly.srk.fer.hr   
      
   On 2012-03-05, rockeet wrote:   
   >   
   > Why C++ committee is so rigidity? They define lambda as exactly the   
   > academism, and intentional didn't add a lambda self reference.   
   > The best solution I have found is to bind the lambda to a   
   > std::function<...> object.   
   >   
   I guess that the need is too rare and the workaround too simple to   
   warrant even more complicated grammar that doesn't bring any new   
   semantics.   
      
   >   
   > If there are some mechanism of lambda self refence, this code should   
   > be more efficient and concise   
   >   
   Why do you think it would be more efficient? Even if the language   
   supported lambda self-reference, it would probably be compiled to   
   the same thing as you hand-coded it: otherwise, how could you support   
   infinite looping?   
      
   In particular, why do you think that the compiler couldn't match the   
   identifier within the lambda body with the name lambda is bound to and   
   use that for optimization?   
      
   I don't have a rigorous proof, but my hunch tells me that the compiler   
   would have to be able to solve the halting problem to generate "more   
   efficient" code.   
      
      
      
      
   --   
    [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
    [ comp.lang.c++.moderated. First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|