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.1 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 6E35ABC69 for ; Fri, 11 May 2007 16:41:00 +0200 (CEST) Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.233]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l4BEex1M001783 for ; Fri, 11 May 2007 16:40:59 +0200 Received: by nz-out-0506.google.com with SMTP id s1so1047559nze for ; Fri, 11 May 2007 07:40:58 -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:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=CivnDswvXPHA6WCIInlpXLMqujG6hHewBhqJVlYBRswYMwrJAUAKEUOxADMBFcuRI+z1AiW3ebPHxHHRTvmu3b6lcFXDDx95UyXbN16WuSQnfUEmWUDpFZWArw3RXoxekgGF6sWLzK4Ds2fFyCBbW3XWDHg8cbgMAjLgQ8nx/40= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=oCVp9XiS+ZgLcQDPnTru8wZ6yZ6s6zxKoykTQtggE83U9g/DU4olEcYiS3sh4qNtxQHKbZKKCT0fngBg4CbdirTkn9ZWFo1ofJoam+48HEqJ/8zayWk0ovXog1G55+2BeRd3T+2s1EJfY7SBK1vZjdzY8m3ynW49+n8cIveYifE= Received: by 10.114.125.2 with SMTP id x2mr964815wac.1178894458602; Fri, 11 May 2007 07:40:58 -0700 (PDT) Received: by 10.114.183.4 with HTTP; Fri, 11 May 2007 07:40:58 -0700 (PDT) Message-ID: Date: Fri, 11 May 2007 16:40:58 +0200 From: "Nicolas Pouillard" To: "Loup Vaillant" Subject: Re: [Caml-list] Custom operators in the revised syntax Cc: "Caml mailing list" In-Reply-To: <6f9f8f4a0705110715l48259b8cr11f22d333ed8d7f5@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1884660607.20070511161455@moldavcable.com> <6f9f8f4a0705110715l48259b8cr11f22d333ed8d7f5@mail.gmail.com> X-j-chkmail-Score: MSGID : 4644807B.000 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 4644807B.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; syntax:01 grebeniuk:01 syntax:01 infix:01 readable:01 readable:01 unreadable:01 unreadable:01 ocaml:01 parsing:01 shalom:98 wrote:01 imho:01 precedence:01 caml-list:01 On 5/11/07, Loup Vaillant wrote: > 2007/5/11, dmitry grebeniuk : > > Shalom, Nicolas. > > > > NP> Today it's about custom operators. In the original syntax everyone > > NP> knows that's easy to define and use custom operators like ++, -->, > > >>>>, +|, =?=, ... and as many as you want. > > > > As for me, the lack of custom infix operators in revised syntax > > is a feature that allows to keep code clean, without any > > "=?=" or "<<+". The code "(func arg1 arg2)" is imho much > > more readable than "arg1 op arg2" because: 1. function name > > usually says something about the meaning of the function, 2. you > > don't need to remember operator's precedence and associativity > > to understand the code. > > I remember a family of languages where (func x y) is the only syntax : Lisp. :) > > I tend to agree when one says custom operators are evil. However, when > the default syntax uses operators, the custom ones are a net win : a > wise programmer will use their semantic load carefully (big nums, for > example), and sparsely, so the code is more readable. An unwise > programmer will make the code unreadable anyway, regardless of the > operators. One always can write unreadable code, no? So it's more a matter of how much using these features than having them. BTW the really cool thing about how custom operators are treated in OCaml is the fact that their understanding do not depend on the definition of them. If you know the parsing rules of + then you know those for +|%@!^&++?@^ -- Nicolas Pouillard