From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "josephoswald+gg@gmail.com" Newsgroups: gmane.emacs.help Subject: Re: The fundamental concept of continuations Date: Tue, 09 Oct 2007 06:50:03 -0700 Organization: http://groups.google.com Message-ID: <1191937803.785801.294310__21696.4710657068$1192017276$gmane$org@v3g2000hsg.googlegroups.com> References: <1191906949.179197.217470@57g2000hsv.googlegroups.com> <470b1b30$0$11022$4c368faf@roadrunner.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: sea.gmane.org 1192017271 25352 80.91.229.12 (10 Oct 2007 11:54:31 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 10 Oct 2007 11:54:31 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Oct 10 13:54:30 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 1Ifa8y-00055S-GP for geh-help-gnu-emacs@m.gmane.org; Wed, 10 Oct 2007 13:54:28 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ifa8s-0001EE-Re for geh-help-gnu-emacs@m.gmane.org; Wed, 10 Oct 2007 07:54:22 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!v3g2000hsg.googlegroups.com!not-for-mail Original-Newsgroups: comp.lang.scheme, comp.lang.lisp, comp.lang.functional, gnu.emacs.help, comp.lang.python Original-Lines: 32 Original-NNTP-Posting-Host: 198.51.251.205 Original-X-Trace: posting.google.com 1191937803 397 127.0.0.1 (9 Oct 2007 13:50:03 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 9 Oct 2007 13:50:03 +0000 (UTC) In-Reply-To: <470b1b30$0$11022$4c368faf@roadrunner.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: v3g2000hsg.googlegroups.com; posting-host=198.51.251.205; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0 Original-Xref: shelby.stanford.edu comp.lang.scheme:74398 comp.lang.lisp:230805 comp.lang.functional:62600 gnu.emacs.help:152759 comp.lang.python:515555 X-Mailman-Approved-At: Wed, 10 Oct 2007 07:53:28 -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:48293 Archived-At: On Oct 9, 2:09 am, "." wrote: > On Tue, 09 Oct 2007 05:15:49 +0000, gnuist006 wrote: > > (3) Is it present in python and java ? > > Certainly not Java, I dunno about Python. I've never seen someone use > them in Python, but the pythonistas seem to want to add everything but a > decent lambda to their language so I wouldn't be surprised if someone had > added a call/cc. Ruby has it. > Continuations exist in all computer languages---actually, in anything that executes code. The continuation is simply "what will happen for the rest of the program execution." What might or might not exist is an explicit linguistic mechanism to examine it, refer to the continuation as a function, or to save it for later use. > > (4) Its implementation in assembly. for example in the manner that > > pointer fundamentally arises from indirect addressing and nothing new. > > So how do you juggle PC to do it. > The continuation is typically present in the stack, which contains all the control-flow information needed to continue program execution from this point. (I.e., the function call mechanism includes a step saving the location of the instruction to execute when the function call is complete, and any registers that it will restore after the function returns because the function call might destroy them.) How you save that continuation for later, possibly repeated, use from a different location in the program is a different question.