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=1.0 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 077F0BC69 for ; Thu, 10 May 2007 23:35:43 +0200 (CEST) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.242]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l4ALZgGU031715 for ; Thu, 10 May 2007 23:35:42 +0200 Received: by an-out-0708.google.com with SMTP id c28so285759ana for ; Thu, 10 May 2007 14:35:41 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=irWfnC2t6p15ppL+s5bQUfpm3HxSeAMcs1reddnRx+yKwSUASOwFeTvq5+EMP+NJf6qdcbrR21cBjIMv/C4+keKLZ1MYLAfbHo0g7M5DrTGuQ5woOjnXSb2pljWqhbQn07XKQs36YCmO3NYR4OKY2TFUPhg0ou+BocgRX4OhQx8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=hGTj/iUNIgSmX/Swk7wZbx+5kph506A+fzRgBLivBtPcJxWeknkroCTa/kaOshJBJhUckRs+3TbKp3G9g8GFZKsV50UCUYN3I2KuDd0Mv3yboFp5ZlIvBxBYIc58OgJUzrJeR3xumE4CFDfrs9UGygti+oN1K6u3zd5GWzCma1s= Received: by 10.100.142.12 with SMTP id p12mr1697101and.1178832941457; Thu, 10 May 2007 14:35:41 -0700 (PDT) Received: by 10.100.168.16 with HTTP; Thu, 10 May 2007 14:35:41 -0700 (PDT) Message-ID: <6f9f8f4a0705101435g48fa4959ia55e6411c966fc17@mail.gmail.com> Date: Thu, 10 May 2007 23:35:41 +0200 From: "Loup Vaillant" To: "Caml List" Subject: Re: [Caml-list] Custom operators in the revised syntax In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: X-j-chkmail-Score: MSGID : 4643902E.000 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 4643902E.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; syntax:01 syntax:01 parens:01 backslash:01 infix:01 associative:01 parens:01 parsing:01 lexer:01 backslash:01 lexer:01 lambda:01 haskell:01 revolution:98 avoids:01 2007/5/10, Nicolas Pouillard : > Hello, > > Again this message is about the revised syntax and it's negative > points or useless distances with the original one. > > Today it's about custom operators. In the original syntax everyone > knows that's easy to define and use custom operators like ++, -->, > >>>, +|, =3D?=3D, ... and as many as you want. > > To declare them in the original syntax one needs parens: > > let ( =3D?=3D ) x y =3D ...;; > > In the revised syntax one use a backslash: > > value \=3D?=3D x y =3D ...; > > Why not... but in the revised syntax these new operators are not > automatically infix or prefix or postfix, you have to make your own > syntax extension. In practice I found it too heavy, unless you already > have a custom syntax extension local to the project or something like > that. I regret that a bit too. However, I can't tell I really miss it: I find the default prefix syntax for function terse enough, so I don't bother. The only useful usage I can think about is associative operators, with which one can fold many arguments at once. For example, the function composition : (f (g (h (i x)))) becomes (f =B0 g =B0 h =B0 i) x wich looks a bit better. > > However there is bad things with parens: > > - Not LL(1) when treating them in parsing > - Spaces must be used for the `*' character to avoids starting comments. > > In fact when dealing them in the lexer that's ok. > And the space issue is not too big. > > Concerning the fixity of these operators I've already changed it to > have the same thing as the original syntax. By the way, which are the fixity and associativity of custom operators in the original syntax? > Concerning the backslash, I want to restore the parens convention to > declare them and then free the backslash character and make it > available in the default lexer (useful for an ascii lambda for > instance). Err, I may not understand, but isn't "fun" terse enough? Or is it just an idea from Haskell? > As before, feel free to make comments on that (not really passionating) s= ubject. It should be : adding up "not really passionating" upgrades may lead to a quiet revolution, eventually. :) Regards, Loup Vaillant