Newsgroups: comp.lang.scheme
Path: cantaloupe.srv.cs.cmu.edu!das-news.harvard.edu!news2.near.net!MathWorks.Com!yeshua.marcam.com!usc!howland.reston.ans.net!pipex!lyra.csx.cam.ac.uk!warwick!uknet!festival!edcogsci!usenet
From: tfb@cogsci.ed.ac.uk (Tim Bradshaw)
Subject: Re: Scheme _in_ Emacs?
In-Reply-To: wgd@zurich.ai.mit.edu's message of 25 Aug 94 01:26:15
Message-ID: <TFB.94Aug31020302@oliphant.cogsci.ed.ac.uk>
Followup-To: comp.lang.scheme
Sender: usenet@cogsci.ed.ac.uk (C News Software)
Nntp-Posting-Host: oliphant
Organization: Centre for Cognitive Science, University of Edinburgh
References: <RAMSDELL.94Aug17063434@triad.mitre.org> <TTHORN.94Aug17150829@ceres.daimi>
	<RAMSDELL.94Aug24085039@triad.mitre.org>
	<WGD.94Aug25012615@martigny.ai.mit.edu>
Date: Wed, 31 Aug 1994 01:03:02 GMT
Lines: 31

* William G Dubuque wrote:
> Could someone clarify just why they think it is impossible to obtain
> proper tail-recursion in GNU Emacs lisp? Perhaps the concern is about
> efficiency vs. implementability.

I'm not quite sure what you mean by this.  

If you mean `is it possible for elisp to be properly tail recursive'
the answer is `no' because of dynamic scope, i.e consider

    (defun foo ()
       (let ((bar 3))
	  (scumble)))

    (defun scumble ()
       ... use bar )

(this sort of thing isn't fixed by the CL emulation either of course
and it affects other stuff than tail recursion).

If you mean `is it possible to implement a tail recursive language in
elisp' the answer is obviously `yes' -- just write a byte interpreter
in elisp for instance.  This probably isn't something you want to do
if you want the resulting language to coexist with existing elisp
code.

If you mean `is it possible to do have a tail recursive language that
compiles to emacs byte codes, I think the answer is `yes' because of
unbind_all which someone mentioned.

--tim
