From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by sympa.inria.fr (Postfix) with ESMTPS id C497A7ED26 for ; Thu, 31 May 2012 20:03:09 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoABANuxx0/RVdS0kGdsb2JhbABEFrN2CCIBAQEBCQkNBxQEI4IYAQEBAgEBEgITGQEBNwEECwsLAxMlDwEEIAEFASITIodaAQMGBQQHmlcJA4pkhC4BBYRMCkANiUgGixGFRpUbgQ+NBz6EAA X-IronPort-AV: E=Sophos;i="4.75,693,1330902000"; d="scan'208";a="146081874" Received: from mail-wi0-f180.google.com ([209.85.212.180]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 31 May 2012 20:03:09 +0200 Received: by wibhj6 with SMTP id hj6so1018089wib.9 for ; Thu, 31 May 2012 11:03:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=XaIJkY/U6iz7u/sGtUQjVSLo9RSmBXHmsV33s4eAUWA=; b=M+QKfX6xJ1YriWsTjh/YJT4jKz9+aH4tkh56siUC4hL3jSOvzqthoBtJ1bErClQD8q 73jiwjfg4/2/pejokCZUGYBDqfGdSETYAJH9mmPfE+XbsMaw0EB+kJrZVXFqXq1Ruy9y /vPb4l6+XG+BsmfufsQT8WwpyA3mnctFa+/AxTqIEVOkveh9XZ6wvS5sdwRWQczO/d07 da3HlP5c5rQh9YXWE7IZIxhQpP4iOPKieG7BwOQ+xV24x0IXHZk3E2eixLUuEh7AAg64 QhkJvCDCnZrsD7P9BtKh7yh60M6IbBmuKAZA8CHGN1ltDumbx9MVacqugrxAj3Vq0WO4 5euQ== Received: by 10.216.206.159 with SMTP id l31mr13654392weo.2.1338487388696; Thu, 31 May 2012 11:03:08 -0700 (PDT) Received: from spec-desktop.danmey.org (cpc1-cmbg12-0-0-cust201.5-4.cable.virginmedia.com. [86.9.116.202]) by mx.google.com with ESMTPS id f7sm3719604wiv.2.2012.05.31.11.03.05 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 31 May 2012 11:03:06 -0700 (PDT) From: Wojciech Meyer To: Gerd Stolpmann Cc: bob zhang , Alain Frisch , caml-list@inria.fr References: <4FC61595.6070009@frisch.fr> <4FC62B53.20504@gmail.com> <4FC76B3E.2070509@frisch.fr> <1338485339.17140.120.camel@thinkpad> Date: Thu, 31 May 2012 19:03:15 +0100 In-Reply-To: <1338485339.17140.120.camel@thinkpad> (Gerd Stolpmann's message of "Thu, 31 May 2012 19:28:59 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Caml-list] Re: Syntax extensions without Camlp4 Gerd Stolpmann writes: > Am Donnerstag, den 31.05.2012, 12:01 -0400 schrieb bob zhang: > I guess you are missing Alain's point here. He suggests to use normal > pattern matching directly on parsetrees, as in > > match expr with > | Pexp_ident id -> Pexp_ident (tranform id) > | Pexp_contant c -> Pexp_constant c > | ... > > instead of using camlp4 syntax quotations (no <<...>> stuff for syntax > manipulation anymore). I admit quotations are *way* better to construct the code, they are syntax aware but also reassemble string manipulation at the same time. If somebody has generated some more serious program using quotations then she can't stand using normal way by constructing via the data constructors. I can compare, because I have used both ways for the same project. Of course normal ASTs have it's wide applications, what is shown above is a transform, and not strictly a code generation - usually I have intermediate AST on the left hand side pattern match and on the right hand side quotations. So I can't say quotations are not useful, they are quite much. If the quotations could be as lightweight as brackets-escape notations of MetaOCaml it would be brilliant. (I'm really talking about code generation - and not extending the syntax). Please see [1]. I'd support the idea of having quotations for the parse trees. -- Wojciech Meyer http://danmey.org [1] http://www.eecs.harvard.edu/~mainland/ghc-quasiquoting/mainland07quasiquoting.pdf