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.0 required=5.0 tests=AWL,SUBJECT_EXCESS_QP 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 DABECBC69 for ; Sun, 16 Dec 2007 16:57:35 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ah4FAFDZZEfUnw7UdWdsb2JhbACCNY1QCwQGDxMHly8 X-IronPort-AV: E=Sophos;i="4.24,172,1196636400"; d="scan'208";a="6884060" Received: from ptb-relay01.plus.net ([212.159.14.212]) by mail3-smtp-sop.national.inria.fr with ESMTP; 16 Dec 2007 16:57:35 +0100 Received: from [80.229.56.224] (helo=beast.local) by ptb-relay01.plus.net with esmtp (Exim) id 1J3vry-0005Jt-H3 for caml-list@yquem.inria.fr; Sun, 16 Dec 2007 15:57:34 +0000 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Ask for a more efficient way =?iso-8859-1?q?to=09deallocate=09memory=09?=(full version) Date: Sun, 16 Dec 2007 15:14:24 +0000 User-Agent: KMail/1.9.5 References: <39980.81.57.198.61.1197236388.squirrel@webmail.lpn.cnrs.fr> <200712102259.30602.jon@ffconsultancy.com> <1197754414.4764482e09e3f@webmail.in-berlin.de> In-Reply-To: <1197754414.4764482e09e3f@webmail.in-berlin.de> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200712161514.25301.jon@ffconsultancy.com> X-Spam: no; 0.00; bandel:01 compiler:01 hand-written:01 ocaml:01 syntax:01 ocaml:01 compiler:01 camlp:01 camlp:01 ocaml's:01 syntax:01 compilation:01 walks:98 shortage:98 frog:98 On Saturday 15 December 2007 21:33, Oliver Bandel wrote: > Zitat von Jon Harrop : > > So Martin's code adds a > > new > > syntactic construct and automatically injects the code for the > > compiler that > > we must currently write by hand. Consequently, its performance will > > be > > superb: as good as hand-written OCaml code. > > So, is it just a kind of pre-compilation? You could say that, yes. It is pre-compiling code written in your own syntax into ordinary OCaml code. > The core-OCaml compiler will be the same? Yes. > Is the TryFinally-code slight enough, so that > it's behaving like handwritten OCaml? Exactly, yes. If you're worried about performance then there are cases where you can actually use camlp4 macros to improve performance. > Did you look at the TryFinally in detail? The article I wrote for the OCaml Journal actually walks through the creation of a camlp4 macro that augments OCaml's syntax with a try..finally construct. > > However, using any camlp4 macros requires using the camlp4 > > replacement for the > > front-end of the compiler. > > I have not looked at the OCaml-compiler in detail, > but from what you wrote I would assume, there > are at least two parts. You don't really see that there are two parts to the compiler. The only thing that intrudes on the programmer (besides different error messages) is the new compilation line. > I had not needed camlp4 so far. And I don't know if it makes sense to > look at it now, because there will be (or already is?) a replacement > (from 3.10 on?). I've only been talking about the new implementation in OCaml 3.10 and beyond. There was a previous implementation as well (now renamed camlp5). > I hope the camlp4-tutorial will be updated to the camlp4-replacement. > Possibly later I might use it. Then it would be good to have > introductional material. Yes. There is certainly a shortage of information on this subject. Eventually the camlp5 will be phased out but I can't see that happening until its new replacement camlp4 is properly documented. -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/products/?e