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



Tel writes:
> > Does Hobbit use trampolines to implement tail calls between C
> > functions?  Or does it just let the stack grow?  Not a criticism, mind
> > you --- getting tail recursion to work is a pain.
> 
> What is wrong with implementing tail calls as `return(foo())' or something
> similar and letting the C compiler optimise them?

What is wrong is that scheme is defined as a properly tail recursive
language and that most C compilers will not optimize tail
recursion. (Some will, but that isn't the point.)

Your scheme compiler should turn tail recursion into a loop, not rely
on the target language to be smarter.

Perry