This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: finite state machines in guile



> It just lets the stack grow.
> OTOH, Hobbit does handle tail recursion, at least for the cases where I've
> checked.

I'm being sloppy.  I meant `tail calls'.  I take your statement here
to mean, "Hobbit does optimize tail calls from a function to itself,
but does not optimize tail calls from one function to another."  Is
that right?

> [btw, what are you refering to with "trampolines" here?  No need to explain
> what a trampoline is, unless you want to, ...
> just looking for implementation details.

Trampolines are one hack for doing tail call optimization when you're
working in C; you invoke functions using a loop like this:

    void trampoline (void (*f) ())
    {
      while ((f = f ()) != 0)
	;
    }

(You have some other structure for passing arguments and receiving
return values.)  Then, to make a tail call, the function just returns
the address of the callee.  Since you're bouncing in and out of the
while loop all the time, it's called a trampoline.

This is not as nice, in my unbenchmarked opinion, as Henry Baker's
"Cheney on the MTA" technique.  Cheney on the MTA is patented, but
Baker has said he doesn't want to discourage anyone from using it, so
he might grant a general license for its use in GPL'd compilers.

> Also, you use tail call in one sentence and tail recursion
> in another.  Typo ? [or bait? :-)]]

Um, if I say "bait", that makes it sounds like I did it deliberately,
right?  :)