Message from discussion
Scheme vs Common Lisp: war stories
Received: by 10.68.223.40 with SMTP id qr8mr9002690pbc.0.1341191695323;
Sun, 01 Jul 2012 18:14:55 -0700 (PDT)
Path: l9ni7945pbj.0!nntp.google.com!news2.google.com!volia.net!news2.volia.net!feed-A.news.volia.net!news.musoftware.de!wum.musoftware.de!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail
From: D Herring <dherr...@at.tentpost.dot.com>
Newsgroups: comp.lang.lisp
Subject: Re: Scheme vs Common Lisp: war stories
Date: Sun, 01 Jul 2012 21:14:53 -0400
Organization: A noiseless patient Spider
Lines: 37
Message-ID: <jsqsme$dat$1@dont-email.me>
References: <3ddeb412-f9a8-4aa6-be6f-24c683ffd62d@o15g2000prn.googlegroups.com> <2012061615121245143-blake@arahantcom> <w2dzk82ziew.fsf@scooby-doo.csail.mit.edu> <20120617171358.805@kylheku.com> <m34npwtwog.fsf@winooski.ccs.neu.edu>
Mime-Version: 1.0
Injection-Date: Mon, 2 Jul 2012 01:14:54 +0000 (UTC)
Injection-Info: mx04.eternal-september.org; posting-host="AT8PF+u+G0F1wUkdH1s1bQ";
logging-data="13661"; mail-complaints-to="ab...@eternal-september.org"; posting-account="U2FsdGVkX190j0t/lvjTZhKivc4Q5tx9"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1
In-Reply-To: <m34npwtwog.fsf@winooski.ccs.neu.edu>
Cancel-Lock: sha1:NsSg4GaWlUz9GjhojcjjMdiVs1U=
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
On 06/27/2012 02:51 PM, Eli Barzilay wrote:
> Kaz Kylheku <k...@kylheku.com> writes:
>>
>> How do you test for it? Say I have some big program which depends on
>> tail recursion in hundreds of places. What if tail recursion isn't
>> happening in some of them?
>
> Testing tail calls is pretty easy, since it's a syntactically
> verifiable property. (And in fact there are things that do exactly
> what you want here.)
Having looked at the trace functionality in Racket (do-traced in
collects/racket/tracke.rkt), I'm not seeing the simplicity of
detecting tail calls. ;)
At least some respectable lispers say to think about tail calls
semantically, not syntactically. In their eyes, the tail call isn't
an optimization; to create the extra stack frame is a wasteful
pessimization.
I somewhat agree with Kaz; IMO the tail position is a subtlety and it
does not explicitly show intent. I would like an explicit (tailcall
#'f ...) that acts like funcall, but the compiler signals if the
function is not in a tail call position. This tailcall form is more
to document intent to other humans (and to catch poorly-written
macros, like a naive TRACE) than it is to help the compiler. A
corresponding notailcall would force the extra stack frame (presumably
for debugging).
A different name would help too. Something that better evokes the
elision of a stack frame. Declarations might work; but CL does not
support them in arbitrary locations...
Maybe I just haven't written enough Scheme code to get a feel for the
culture. C++ has its share of gotchas that I've learned to live with.
- Daniel