[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Tail Call Optimization in guile

From: jjh02
Subject: Tail Call Optimization in guile
Date: Fri, 13 Jul 2007 14:55:26 -0400
User-agent: Internet Messaging Program (IMP) 3.2.6


I'm a little confused. The Wikipedia entry on guile has a vague statement about
how guile can't do tail call optimization in functions that use C code. If this
is true, this seems like a major, crippling constraint, since most non-trivial
use of guile as an extension language will involve calling native code, and
many simple functions aren't feasible without tail call optimization. But the
guile documentation doesn't seem to mention this drawback anywhere, and I know
that other scheme to C interfaces, like gambit-c, have no problem with this.

The conclusion I've drawn is that the Wikipedia article is far too vague, and
that in fact guile can optimize tail calls in all cases except when C code and
scheme code are mutually recursive; that is, scheme code calls C code which
calls the scheme code again. This makes much more sense to me. Is this correct?
Are there other situations where guile has trouble with tail calls?

Wikipedia also says that guile has difficulties with call/cc, and I assume this
is a similar issue, calling a continuation that was captured in scheme code
that was called from a different C function than the currently running scheme
code. Right? (confusing sentence, I know!)

The guile documentation has a chapter called "Functional and performance
constraints," which is currently completely empty. I assume it is meant to
cover issues such as these.  If somebody can point me towards some answers,
I'll go and set the record straight on Wikipedia.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]