From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 42FE4BC57 for ; Sun, 31 Oct 2010 16:31:28 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhsBAAwpzUzRVdQ2i2dsb2JhbAChQQgVAQEBCgsKBw8FH6AxiVqCF4UsLohXAQEDBYU/BIpU X-IronPort-AV: E=Sophos;i="4.58,268,1286143200"; d="scan'208";a="85816897" Received: from mail-vw0-f54.google.com ([209.85.212.54]) by mail1-smtp-roc.national.inria.fr with ESMTP; 31 Oct 2010 16:31:27 +0100 Received: by vws12 with SMTP id 12so2474996vws.27 for ; Sun, 31 Oct 2010 08:31:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type; bh=Ja7pxB7nHnEmoQ6rzvlVqmboEkj+yXlMRlzjW7AP4Mc=; b=XM+eCdQsQIjTSKe9yyYUJsM6m9thcfbBTzGqbS7aBM06pMENY2fSlMdgwTW//nX/na o1rNzTw//UVwTTMhYAuTclbnNIEwNAI2fBcUPX2ykxdAXA0ht3wNBLCsPtUB6G8aLr1O 1RIfM2BwSBd2UZ5E1AEkCue9sBQhd/MV0iLtQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=AsHL7H/NQNux2jdd3Rcw1IjCG5+PcSC0R2huz4s/yxW73medg+QBt3B6Y0E8XF1DEz K5Z/de9nZWPAqxNV8Zy+xCIS2nD78W1U2VKVrop3aOqLc3vFPlMzPS8vaqohkWNwu09w u+NwO6lpOu79axYgEzF3jcm43kOPpRhRmoFBI= Received: by 10.224.177.210 with SMTP id bj18mr7015797qab.372.1288539087284; Sun, 31 Oct 2010 08:31:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.230.145 with HTTP; Sun, 31 Oct 2010 08:31:06 -0700 (PDT) In-Reply-To: References: <904846.44200.qm@web111513.mail.gq1.yahoo.com> <87tyk2v46e.fsf@gmail.com> From: Lukasz Stafiniak Date: Sun, 31 Oct 2010 16:31:06 +0100 Message-ID: Subject: Re: [Caml-list] Re: Generalized Algebraic Datatypes To: Sylvain Le Gall Cc: caml-list@inria.fr Content-Type: text/plain; charset=ISO-8859-1 X-Spam: no; 0.00; lukasz:01 datatypes:01 le-gall:01 ocaml:01 ocaml:01 toplevel:01 syntax:01 toplevel:01 camlp:01 camlp:01 syntax:01 constr:01 parsed:01 wrote:01 abstract:01 On Sun, Oct 31, 2010 at 4:08 PM, Sylvain Le Gall wrote: > > Function names and values are "low id" in OCaml (first letter must be > uncapitalized). If you try to define "let MyConstr = 0" in an OCaml > toplevel, you will get a syntax error... In unmodified toplevel, but the whole point is to use camlp4 (or camlp5). > The code generated by camlp4 must be syntactically correct. No, camlp4 generates syntax trees (i.e. they don't have syntax other than abstract syntax). (But if there are any asserts in OCaml source that an AST element called a lower case identifier is actually lower case, that could be a problem.) > But maybe you are talking about a deeper integration? One possibility would be to translate any "Constr" into a value in contexts where it cannot be parsed as applied to a value, and as constructor where it is applied to a value... It wouldn't be directly partially applicable, but it would serve most purposes since it would work as a function when passed to higher order functions as fold (and also could be easily rebound).