From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 7E04DBCAB for ; Fri, 27 May 2005 13:14:07 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j4RBE6XW026003 for ; Fri, 27 May 2005 13:14:06 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id NAA32057 for ; Fri, 27 May 2005 13:14:06 +0200 (MET DST) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j4RBE5uD025998 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Fri, 27 May 2005 13:14:06 +0200 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1DbckM-0000CA-2A for caml-list@inria.fr; Fri, 27 May 2005 13:11:22 +0200 Received: from host155-157.pool8249.interbusiness.it ([82.49.157.155]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 27 May 2005 13:11:22 +0200 Received: from vincenzo_yahoo_addressguard-gmane by host155-157.pool8249.interbusiness.it with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 27 May 2005 13:11:22 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: caml-list@inria.fr From: Vincenzo Ciancia Subject: Re: infix functions Date: Fri, 27 May 2005 13:13:07 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: host155-157.pool8249.interbusiness.it User-Agent: KNode/0.9.0 Sender: news X-Miltered: at concorde with ID 429700FE.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 429700FD.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; infix:01 infix:01 lexer:01 redefined:01 redefining:01 struct:01 sig:01 val:01 val:01 inlining:01 attenzione:98 l'indirizzo:98 posta:98 nel:98 campo:98 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 wrote: > Hi, > > I see some pervasive functions are infix, and I'm wondering if there's > any plan to support making any arbitrary infix functions? > > For instance, the Int32 (etc) modules are horrible to use cause of the > prefix functions. These are perfect candidates for being infix. Not arbitrary, but there are some "free" symbols that can be defined (I don't know exactly how many and what, but I guess it's on the manual or in the lexer :) ), and all the infix operators can be redefined. Example of redefining "+": ######## # module InfixInt32 = struct let (+) = Int32.add end;; module InfixInt32 : sig val ( + ) : int32 -> int32 -> int32 end # 3+3;; - : int = 6 # open InfixInt32;; # 3+3;; This expression has type int but is here used with type int32 ####### example of defining "+*" ####### # let (+*) = Int32.add;; val ( +* ) : int32 -> int32 -> int32 = # 30l +* 20l;; - : int32 = 50l ####### I don't know if there is a way to force inlining of "+*" though, but I suppose that you could finally resort to defining your operators in camlp4 http://pauillac.inria.fr/caml/camlp4/manual/manual006.html see section 5.3.1 Bye Vincenzo -- Please note that I do not read the e-mail address used in the from field but I read vincenzo_ml at yahoo dot it Attenzione: non leggo l'indirizzo di posta usato nel campo from, ma leggo vincenzo_ml at yahoo dot it