Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.misty.com!news.iecc.com!.POSTED!nerds-end From: Hans-Peter Diettrich Newsgroups: comp.compilers Subject: Re: Is multi-level function return possible? Date: Thu, 27 Mar 2014 01:58:48 +0100 Organization: Compilers Central Lines: 27 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <14-03-067@comp.compilers> References: <14-03-020@comp.compilers> <14-03-022@comp.compilers> <14-03-025@comp.compilers> <14-03-030@comp.compilers> <14-03-044@comp.compilers> <14-03-046@comp.compilers> <14-03-047@comp.compilers> <14-03-048@comp.compilers> <14-03-053@comp.compilers> <14-03-057@comp.compilers> <14-03-060@comp.compilers> NNTP-Posting-Host: news.iecc.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: miucha.iecc.com 1395883853 21384 2001:470:1f07:1126:0:676f:7373:6970 (27 Mar 2014 01:30:53 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Thu, 27 Mar 2014 01:30:53 +0000 (UTC) Keywords: symbols, history, comment Posted-Date: 26 Mar 2014 21:30:53 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:1189 George Neuner schrieb: > The instruction cost is slightly greater to maintain a display than to > maintain a static chain, but if the display is in suitably fast memory > - in registers or locked into cache - the actual difference in *time* > spent on maintenance may be insignificant. Many years ago I found a funny implementation of local variables in GfA-Basic. As opposed to most (all?) other compilers, on entry of a subroutine the *global* variables; matching the name of a local variable or parameter; were pushed onto the stack and re-initialized for use inside the subroutine, and restored on exit. This allows to access all currently living variables from everywhere in the code. It also allows for by-name references when the table of variables is prepared accordingly, as was the case in traditional Basic. Dunno how Algol implemented this and its many other exotic parameter passing conventions. I found that implementation so exciting, that I think it's worth to be mentioned here. DoDi [That's approximately what Lisp calls shallow binding. For Algol60 call by name, which was a mistake, it needed the Pascal display or the equivalent, and arguments had to be callback routines (thunks) to allow them to recompute the expression values. -John]