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.1 required=5.0 tests=AWL autolearn=disabled version=3.1.3 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 7E69CBB84 for ; Mon, 6 Oct 2008 16:06:31 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtUEAJ+46Ugmachl/2dsb2JhbACBcblfgWo X-IronPort-AV: E=Sophos;i="4.33,368,1220220000"; d="scan'208";a="17709641" Received: from mx1.janestcapital.com (HELO nyc-qsv-mx1.delacy.com) ([38.105.200.101]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 06 Oct 2008 16:06:18 +0200 Received: from nyc-qsv-mail1.delacy.com ([172.25.22.57]) by nyc-qsv-mx1.delacy.com with esmtp (Exim 4.69) (envelope-from ) id 1Kmqiy-0001Iy-Ra; Mon, 06 Oct 2008 10:06:13 -0400 Received: from nyc-qws-007.delacy.com ([172.25.131.107]) by nyc-qsv-mail1.delacy.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1Kmqiy-0002ry-P8; Mon, 06 Oct 2008 10:06:12 -0400 Message-ID: <48EA1B54.5030200@janestcapital.com> Date: Mon, 06 Oct 2008 10:06:12 -0400 From: Brian Hurt User-Agent: Thunderbird 2.0.0.14 (X11/20080506) MIME-Version: 1.0 To: Jon Harrop Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Metaprogramming features References: <884069.59268.qm@web54601.mail.re2.yahoo.com> <200810040300.02624.jon@ffconsultancy.com> In-Reply-To: <200810040300.02624.jon@ffconsultancy.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; metaocaml:01 ocaml:01 metaocaml:01 ocaml:01 non-trivial:01 wrote:01 wrote:01 compile:01 experimental:01 caml-list:01 data:02 structures:02 namely:02 represented:02 constructs:02 Jon Harrop wrote: > On Friday 03 October 2008 16:09:40 Dario Teixeira wrote: > >> Hi, >> >> >>> I really wish that the basic features of metaocaml, namely >>> .< >., .~ and .! were included in OCaml proper. The many other >>> experimental features of metaocaml could stay 'experimental', >>> those are the 3 which are sorely needed. >>> >> To those of us not familiar with MetaOcaml, could you give us >> an overview of what these features mean and why they are so >> special? >> > > MetaOCaml extends OCaml with three constructs that allow programs to generate, > compile and evaluate code at run time. > > Code is represented by the form: > > .< 1 + 2 >. > > This may be executed using: > > .! .< 1 + 2 >. > > Values may be injected into code using: > > .< 1 + .~x >. > > 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. Brian