From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: rpw3@rpw3.org (Rob Warnock) Newsgroups: gmane.emacs.help Subject: Re: The fundamental concept of continuations Date: Fri, 12 Oct 2007 22:11:00 -0500 Organization: Rob Warnock, Consulting Systems Architect Message-ID: References: <1191906949.179197.217470@57g2000hsv.googlegroups.com> <85zlyrutux.fsf@lola.goethe.zz> <85lka8p2h4.fsf@lola.goethe.zz> NNTP-Posting-Host: lo.gmane.org X-Trace: sea.gmane.org 1192250812 10669 80.91.229.12 (13 Oct 2007 04:46:52 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 13 Oct 2007 04:46:52 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Oct 13 06:46:40 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IgYta-00008c-IL for geh-help-gnu-emacs@m.gmane.org; Sat, 13 Oct 2007 06:46:38 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IgYtU-0004nj-9Y for geh-help-gnu-emacs@m.gmane.org; Sat, 13 Oct 2007 00:46:32 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.speakeasy.net!news.speakeasy.net.POSTED!not-for-mail Original-NNTP-Posting-Date: Fri, 12 Oct 2007 22:11:00 -0500 Original-Newsgroups: comp.lang.scheme, comp.lang.lisp, comp.lang.functional, gnu.emacs.help, comp.lang.python X-Newsreader: trn 4.0-test76 (Apr 2, 2001) Originator: rpw3@rpw3.org (Rob Warnock) Original-Lines: 61 X-Usenet-Provider: http://www.giganews.com Original-NNTP-Posting-Host: 66.93.131.53 Original-X-Trace: sv3-WlI3gczeaPA1bTFL/9sa+GHZvDIv8EN+WGq2D726eeaUd6ZRKwo8RuDq4EyNaigUQlZD13aO2xMEtEG!hLlx5QpgSck8Nn1KGvvVUd1+2iKQMn6C/RiCut75B/n4fLl3HszqGy9uGBRdWoqX74HZqsSop2If!nCYswMdriI58I58DeTyOo7fpH24= Original-X-Complaints-To: abuse@speakeasy.net X-DMCA-Complaints-To: abuse@speakeasy.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.35 Original-Xref: shelby.stanford.edu comp.lang.scheme:74465 comp.lang.lisp:231029 comp.lang.functional:62651 gnu.emacs.help:152869 comp.lang.python:516136 X-Mailman-Approved-At: Sat, 13 Oct 2007 00:45:05 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:48375 Archived-At: David Kastrup wrote: +--------------- | George Neuner writes: | > Upward continuations can be stack implemented. On many CPU's, using | > the hardware stack (where possible) is faster than using heap | > allocated structures. For performance, some Scheme compilers go to | > great lengths to identify upward continuations and nested functions | > that can be stack implemented. | | There is a Scheme implementation (I keep forgetting the name) which | actually does both: it actually uses the call stack but never returns, | and the garbage collection includes the stack. +--------------- You're thinking of "Chicken Scheme": http://www.call-with-current-continuation.org/ Chicken Scheme is actually using the C call stack *as* the heap[1], and thus all its continuations are *heap*-allocated, and thus not actually "stack-allocated" at all. But that's not what George Neuner is talking about, as I read it, but rather probably about such things as Kent Dybvig's PhD thesis: http://www.cs.indiana.edu/~dyb/papers/3imp.pdf "Three Implementation Models for Scheme" R. Kent Dybvig, UNC Chapel Hill, 1987 (thesis) (190pp) ... Chapter 4: The Stack-Based Model ... Early Scheme implementors believed that because of the need to support first class functions, the standard techniques used for block-structured languages were not suitable for Scheme. The need to optimize tail calls and support continuations further convinced early implementors that the standard stack techniques were unsuitable. However, as this chapter will show, these techniques can be made to work for Scheme with a few modications. The resulting implementation model allows most function calls to be performed with little or no allocation, and allows variable references to be performed in one or two memory references. Heap allocation remains necessary to support closures, assigned variables, and continuations. Since function calls and variable references are faster and heap allocation is limited, the running time for most programs is greatly decreased. ... -Rob [1] As suggested in: http://home.pipeline.com/~hbaker1/CheneyMTA.html "CONS Should Not CONS Its Arguments, Part II: Cheney on the M.T.A" Henry G. Baker (1994) ----- Rob Warnock 627 26th Avenue San Mateo, CA 94403 (650)572-2607