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=0.7 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 445CDBC0A for ; Sun, 13 May 2007 17:42:26 +0200 (CEST) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.173]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l4DFgPML001469 for ; Sun, 13 May 2007 17:42:26 +0200 Received: by ug-out-1314.google.com with SMTP id k3so910243ugf for ; Sun, 13 May 2007 08:42:25 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=YJariEh3vNFLw0jM7t99QLXCTEnksqMdVTgtysIx8fFbsFB+CRPmCRFNTdjxupdolsl+dgNGuMTbmS8ZhDpth/BaQVljq+fDmZPRlZMuuRp7GJmdX4FgT6NwsoVe5rkOKR3hPBvUEdog275taZpmdM0qN3HymXWgbNTvZZrP66I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=YitdPOKM88x/VZsh3k2nY+WlVbcQRP/XoZUPoCr4Ry2uFyFGISFt5v2QDKhO2BusyKAQwblzzcvXbO37pmA0JvXUm+jKhvZAh7zvaa5VwWzH4rwRwJyhBRXyoP+sfSfq0JdV9+1zeu0qOIT0iM0iFSe37r+1emCb9CR+2QXVxes= Received: by 10.66.232.9 with SMTP id e9mr4504934ugh.1179070945077; Sun, 13 May 2007 08:42:25 -0700 (PDT) Received: from ?192.168.0.6? ( [87.88.165.197]) by mx.google.com with ESMTP id 20sm9741056uga.2007.05.13.08.42.23; Sun, 13 May 2007 08:42:24 -0700 (PDT) Message-ID: <464731DE.5070002@lix.polytechnique.fr> Date: Sun, 13 May 2007 17:42:22 +0200 From: Arnaud Spiwack User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 To: caml-list@inria.fr Subject: Re: [Caml-list] Custom operators in the revised syntax References: <200705111537.32561.jon@ffconsultancy.com> <200705120348.50308.jon@ffconsultancy.com> <1178944803.14691.28.camel@rosella.wigram> <20070512102254.GA862@furbychan.cocan.org> In-Reply-To: <20070512102254.GA862@furbychan.cocan.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Sender: Arnaud Spiwack X-Miltered: at discorde with ID 464731E1.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; lix:01 syntax:01 coq:01 usefull:01 notation:01 infix:01 infix:01 notation:01 overloading:01 usefull:01 ocaml:01 syntax:01 frisch:01 arnaud:01 arnaud:01 About that, Coq uses something that proved itself to be rather usefull, though the problematic is a bit different. It's called notation scopes. The idea is that infix operators are defined in a specific scope. That you can either open locally using (here the scope is open)%scopeName, or globally by using Open Scope scopeName. When a scope is open, all the infix operators are interpreted as its definition in that scope. There are also a few more technicalities to make it even more fun (for instance, you can bind a scope to a type t, then, whenever an expression is inferred to be type t, the scope t is automatically opened, it's a very useful feature). This allows a milde, but rather usable notation overloading. I've been wondering for quite a while if such a policy would be reasonable/usefull for OCaml. My two pennies, Arnaud Spiwack Richard Jones a écrit : > If it is true that parts of the program will typically use a single > class of operator, then what about a simple syntax extension like: > > with BigInt > let a = b + c * d in > > Similar, in fact, to the very desirable "local open" feature > (http://alain.frisch.fr/soft.html#openin) > > Rich. > >