Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.compilers    |    Compiler construction, theory, etc. (Mod    |    2,753 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 1,877 of 2,753    |
|    andy johnson to All    |
|    Re: How to implement lexical closures?    |
|    09 May 10 10:45:07    |
   
   From: sleepdev@gmail.com   
      
   In terms of performance, for stack based languages you might want to   
   take a look at a technique called lambda lifting (http://   
   en.wikipedia.org/wiki/Lambda_lifting). The effect of which is to   
   reduce a program with closures to a program without closures. However   
   it is nontrivial to implement(consider the case of functions that   
   return functions) and as such may be easier to take the memory and/or   
   performance hit and just pass around closures explicitly.   
      
   Explicit closure passing may be implemented as continuations:   
      
   abstract class Continuation   
   {   
    Object[] closure;   
    Object call(Object[] args);   
   }   
      
   it is important to note also that all top level functions would also   
   need to use this interface in order to normalize the calling   
   convention for first-class functions.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca