From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 99026BCAB for ; Fri, 27 May 2005 13:12:56 +0200 (CEST) Received: from ext.lri.fr (ext.lri.fr [129.175.15.4]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j4RBCumU012410 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Fri, 27 May 2005 13:12:56 +0200 Received: from localhost (localhost [127.0.0.1]) by ext.lri.fr (Postfix) with ESMTP id 2B73519E7AB; Fri, 27 May 2005 13:12:56 +0200 (CEST) Received: from ext.lri.fr ([127.0.0.1]) by localhost (ext.lri.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 03047-01; Fri, 27 May 2005 13:12:56 +0200 (CEST) Received: from smtp.lri.fr (serveur3-5 [129.175.3.5]) by ext.lri.fr (Postfix) with ESMTP id 16B8019E79B; Fri, 27 May 2005 13:12:56 +0200 (CEST) Received: from pc9-152 (pc9-152 [129.175.9.152]) by smtp.lri.fr (Postfix) with ESMTP id 8F6B6CED98; Fri, 27 May 2005 13:12:55 +0200 (CEST) Received: from filliatr by pc9-152 with local (Exim 3.36 #1 (Debian)) id 1Dbcls-0005mO-00; Fri, 27 May 2005 13:12:56 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17047.183.987063.355357@gargle.gargle.HOWL> Date: Fri, 27 May 2005 13:12:55 +0200 To: Jonathan Roewen Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] infix functions In-Reply-To: References: X-Mailer: VM 7.18 under Emacs 21.3.1 From: Jean-Christophe Filliatre X-Virus-Scanned: by amavisd-new at lri.fr X-Miltered: at nez-perce with ID 429700B8.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 infix:01 filliatre:01 filliatre:01 lri:01 infix:01 notation:01 notations:01 ...:98 writes:01 lexical:01 precedence:01 functions:01 functions:01 modules:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: Jonathan Roewen writes: > > For instance, the Int32 (etc) modules are horrible to use cause of the > prefix functions. These are perfect candidates for being infix. And > being an OS project, there are a lot of instances where we need the > extra precision, and having to do things like add some_int32 > another_int32 complex. Especially when you have to throw in > bitshifting, AND and OR, and other magic. In some simple cases, it can help to insert let (+) = Int32.add let (-) = Int32.sub ... at the beginning of your files (or better to put these declarations within a small module that you open only when you need the infix notation). You can even adopt other notations, such as +!, -!, etc. Only the first character is used to determine the operator precedence. Beware of the lexical issue with multiplication :-) Hope this helps, -- Jean-Christophe