Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[ANN] OCaml-Java project: 1.0 release
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-05-27 (08:36)
From: Till Varoquaux <till.varoquaux@g...>
Subject: Re: [Caml-list] [ANN] OCaml-Java project: 1.0 release
First of all I must apologize to everyone reading the list: I seem to
have a bad case of dyslexia today and my previous mails are written in
horrible english...

Anyways; here goes for trampolines (straight from wikipedia):

"Used in some LISP implementations, a trampoline is a loop that
iteratively invokes thunk-returning functions. A single trampoline is
sufficient to express all control transfers of a program; a program so
expressed is trampolined or in "trampolined style"; converting a
program to trampolined style is trampolining. Trampolined functions
can be used to implement tail recursive function calls in
stack-oriented languages."

Trampolines tend to have a very high runtime cost. You have to think
very carefully about the tradeoffs when converting a whole program to
using them.

On Tue, May 27, 2008 at 8:26 AM,  <> wrote:
> Selon Till Varoquaux <>:
>> On Tue, May 27, 2008 at 7:06 AM, Jon Harrop <> wrote:
>> > On Tuesday 27 May 2008 06:46:23 wrote:
>> > 4. Are tail calls fully implemented and, if not, when exactly do they work?
>> One cannot fully implement tail calls on the JVM: there's no such
>> thing as a goto or a tail call instruction.
>> Tail recursion can usually be done for cheap. The general requires
>> some expensive machinery (usually trampolines)
> Well, to be precise the JVM provides a "goto" instruction, albeit limited
> to offsets in the same method. This allows to easily implement tail calls
> for direct recursion (and this is done in OCaml-Java).
> Can you explain what you mean by "trampoline" in the Java/JVM context ?
> Xavier Clerc
> _______________________________________________
> Caml-list mailing list. Subscription management:
> Archives:
> Beginner's list:
> Bug reports: