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-06 (16:47) |
From: | Chung-chieh Shan <ccshan@p...> |
Subject: | Re: Metaprogramming features |
Jon Harrop <jonathandeanharrop@googlemail.com> wrote in article <200810061656.42903.jon@ffconsultancy.com> in gmane.comp.lang.caml.inria: > On Monday 06 October 2008 15:06:12 you wrote: > > I'm definitely missing something here. How are the above examples > > different from: > > let f () = 1 + 2;; > > f ();; > > let f x = 1 + x;; > > > > ? > > > > This is a non-trivial question, as there is no clear delineation between > > data structures and executable code. Indeed the question is not trivial. Because MetaOCaml (like OCaml) has higher-order functions (which may operate on code values or on functions on code values), it is not trivial at all to `simulate' MetaOCaml in OCaml. Our PEPM paper this year (Kameyama, Kiselyov, and Shan) needed the full power of System F just to express a subset of MetaOCaml without polymorphism (even let-bound) or nested quotation (such as .<.<42>.>.). http://www.cs.rutgers.edu/~ccshan/metafx/pepm66-kameyama.pdf Section 2 of this paper gives a series of examples to illustrate the non-triviality of the simulation. You can try to skip to Section 2.5 to see the most challenging example there. > 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. -- Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig 2008-10-01 International Day of Older Persons http://www.who.int/ageing/ 2008-11-20 Universal Children's Day http://www.unicef.org/ 2008-11-25 Day for the Elimination of Violence Against Women http://unifem.org/ 1948-12-10 Universal Declaration of Human Rights http://everyhumanhasrights.org