Browse thread
Metaprogramming features
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2008-10-07 (12:50) |
From: | Nicolas Pouillard <nicolas.pouillard@g...> |
Subject: | Re: [Caml-list] Re: Metaprogramming features |
Excerpts from jonathandeanharrop's message of Tue Oct 07 02:17:13 +0200 2008: > On Monday 06 October 2008 17:46:49 Chung-chieh Shan wrote: > > Jon Harrop <jonathandeanharrop@googlemail.com> wrote in article > <200810061656.42903.jon@ffconsultancy.com> in gmane.comp.lang.caml.inria: > > > Exactly. The difference is (only) the performance characteristics. > > > > To the contrary, that is not the only difference; the timing of > > side effects (including non-termination and exceptions) can also be > > different. We give an example at the beginning of our Section 2. > > I don't follow. Your paper translates the following staged function: > > let power7 : int -> int = > .! .<fun x -> .~(Printf.printf "power\n"; power 7 .<x>.)>.;; > > into this: > > let npower7 = > (fun () -> fun x -> (printf "power\n"; npower 7 (fun () -> x)) ()) ();; > > and notes that the result is different because the former calls printf > immediately whereas the latter defers. > > Surely the discrepancy is because the translation should be: > > let npower7 = > let e = printf "power\n"; npower 7 (fun () -> x) in > (fun () -> fun x -> e ()) ();; Hum "unbound value x" :) -- Nicolas Pouillard aka Ertai