From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id E1442BBAF for ; Tue, 27 May 2008 10:36:48 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgoKAFxkO0jRVcitZmdsb2JhbACSOg0EAwQJFJULhSw X-IronPort-AV: E=Sophos;i="4.27,547,1204498800"; d="scan'208";a="26642507" Received: from wf-out-1314.google.com ([209.85.200.173]) by mail4-smtp-sop.national.inria.fr with ESMTP; 27 May 2008 10:36:47 +0200 Received: by wf-out-1314.google.com with SMTP id 24so2064191wfg.15 for ; Tue, 27 May 2008 01:36:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=Ydn3Z6NAhGZ9QZMg/YWrTHSkhfRvOwt3T7+5RD3C174=; b=w0mcTP0gjzu48SgD+PCSrlBSfhMA28jz6Zxn2qKvoKksV/iP9yUIoCC0PujPb4IKFzrAv1MRqjjdrtBdTSmfXZ8joyHMktFTq34Fdy3/KjzfpTvvuj+O85sUcNpo/dkSQVJigM22QX29SOBWCI74xNy3gawGA/aBVNt8q1kS2FU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Lr0hhrQxY//C7xWP0QkKeIvstYdz1jZqcYhRZlZFN7pukSRyK9lyC4FnwB8m+tGGBtJn3KjTEJD4ezVWRhMLiXucT1wuN+pMu6qO2/J5VoCsFtY8Nu7Hc3DRIsC+Pq93pbc3O/3FFR03OjbpvXe7RVugQ5qElAL078PHEjAXkBU= Received: by 10.142.157.15 with SMTP id f15mr386826wfe.291.1211877406168; Tue, 27 May 2008 01:36:46 -0700 (PDT) Received: by 10.142.72.20 with HTTP; Tue, 27 May 2008 01:36:46 -0700 (PDT) Message-ID: <9d3ec8300805270136w75102bci903324b0ee8bb846@mail.gmail.com> Date: Tue, 27 May 2008 09:36:46 +0100 From: "Till Varoquaux" To: forum@x9c.fr Subject: Re: [Caml-list] [ANN] OCaml-Java project: 1.0 release Cc: caml-list@yquem.inria.fr In-Reply-To: <1211873192.483bb7a8d5597@imp.ovh.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <764D4B4A-FA1E-4672-BA9D-4195193E1C48@x9c.fr> <200805270706.20939.jon@ffconsultancy.com> <9d3ec8300805262337o6cb390f0ma986212e065132d6@mail.gmail.com> <1211873192.483bb7a8d5597@imp.ovh.net> X-Spam: no; 0.00; wikipedia:01 trampoline:01 invokes:01 trampoline:01 recursive:01 runtime:01 recursion:01 recursion:01 beginner's:01 ocaml:01 bug:01 1.0:98 beginners:01 wrote:01 wrote:01 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. HTH, Till 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 forum@x9c.fr 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: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > -- http://till-varoquaux.blogspot.com/