Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news-out.readnews.com!news-xxxfer.readnews.com!news.misty.com!news.iecc.com!.POSTED!nerds-end From: Marco van de Voort Newsgroups: comp.compilers Subject: Re: Is multi-level function return possible? Date: Fri, 14 Mar 2014 22:59:28 +0000 (UTC) Organization: Stack Usenet News Service Lines: 32 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <14-03-038@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-035@comp.compilers> NNTP-Posting-Host: news.iecc.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: miucha.iecc.com 1394892306 19754 2001:470:1f07:1126:0:676f:7373:6970 (15 Mar 2014 14:05:06 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Sat, 15 Mar 2014 14:05:06 +0000 (UTC) Keywords: Pascal, code, comment Posted-Date: 15 Mar 2014 10:05:06 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:1160 On 2014-03-14, Kaz Kylheku wrote: >> Standard Pascal did have not have closures: you could pass a function >> by name as an argument to another, but its definition had to be >> visible both at the point of passing the name and at the point of >> invocation [through the aliasing argument]. > > Okay, forget Pascal then with these bizarre restrictions. Let's > pretend that "Pascal" really means "GNU C" (with its local functions). > http://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html > > GNU C has real downard funargs, a.k.a. non escaping closures. > > (I thought Pascal was like this; but if not, it's too broken to > warrant another thought.) > > So your comment could have said "your GNU C is showing". :) Syntax is similar, but most Pascal implementations don't use trampolines, but simply expand the procedure type to be wider (frame pointer and address). Gnu Pascal inherited the C school of thought, and uses trampolines afaik to keep function pointers (single) pointers at all cost. The earlier mentioned Delphi anonymous functions (closure-likes) internally are ref counted interfaces to my best knowledge. P.s. quickreading your URL I didn't really see if GNU C can have multiple levels of nesting. Pascal can. [Yes, it can. -John]