From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id q3R8UPgP031992 for ; Fri, 27 Apr 2012 10:30:25 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtUCAGdYmk/ZSMDqlGdsb2JhbABFsXsiAQEBAQkLCQkUAySCCQEBBAE6PxALISUPAQQNGyETG4djAQMGCbIwHysNiVOKB4c8BJtehVyHbQ X-IronPort-AV: E=Sophos;i="4.75,490,1330902000"; d="scan'208";a="155869893" Received: from fmmailgate03.web.de ([217.72.192.234]) by mail1-smtp-roc.national.inria.fr with ESMTP; 27 Apr 2012 10:30:20 +0200 Received: from moweb001.kundenserver.de (moweb001.kundenserver.de [172.19.20.114]) by fmmailgate03.web.de (Postfix) with ESMTP id F2A471B3FF60C for ; Fri, 27 Apr 2012 10:30:19 +0200 (CEST) Received: from frosties.localnet ([95.208.118.96]) by smtp.web.de (mrweb002) with ESMTPA (Nemesis) id 0M9GYQ-1SUrqO3JfC-00ChwM; Fri, 27 Apr 2012 10:30:19 +0200 Received: from mrvn by frosties.localnet with local (Exim 4.77) (envelope-from ) id 1SNgZG-0003Re-Aa; Fri, 27 Apr 2012 10:30:18 +0200 From: Goswin von Brederlow To: Gabriel Scherer Cc: Haoyang Wang , caml-list@inria.fr References: <3C0F509D-8590-4D45-A586-83630088C7B5@pobox.com> Date: Fri, 27 Apr 2012 10:30:18 +0200 In-Reply-To: (Gabriel Scherer's message of "Fri, 27 Apr 2012 08:57:08 +0200") Message-ID: <87lilha86d.fsf@frosties.localnet> User-Agent: Gnus/5.110009 (No Gnus v0.9) XEmacs/21.4.22 (linux, no MULE) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Provags-ID: V02:K0:dolJV28pC9wzXrBP1c9Klh075xtxaQJTnef+LtSS4EQ qnNEzqzLDGiqPsilHhC2PiMVUUuymVP0SZrDup4fUBFhBRUOCf /KIebDxR+HCMLs39tW49lZYkE524abeZJHLvCsrDRJVqCtKIHH o6wax+wRRG0g8JyVjDFfWMjPNFGyT3L2tjnyOIiRVBTEL+O1ff 6QRZ72xhw2ioQgyoW4fUA== Subject: Re: [Caml-list] using infix operators/functions in modules when not using "open" Gabriel Scherer writes: >> Module.("foo" (op) "bar") > > This is a local open (a more explicit notation is "let open Module in > foo op bar"). I think this is a fine solution: I don't like open, but > local mitigates its flaws. > > Another solution is to rebind your operator locally: > > let (op) = Module.blah in > "foo" op "bar" > > (of course Module.blah doesn't need to be an infix itself) > > If you are going to use an infix operator in a wide scope, I think > that such a rebinding solution is nice because it's more explicit, > which is good when it helps users understand the code. And that also works more globally as in let (op) = Module.blah let foo x y = x (op) y MfG Goswin