Gabriel Scherer <gabriel.sche...@gmail.com> 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

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to