On 8 August 2010 17:47, bluestorm <bluestorm.d...@gmail.com> wrote:
> If you don't have any of these, you have to declare infix operators
> directly inside the module. You'd have a "val (=) : int -> int ->
> bool" in the "int.ml" file for example. That's notoriously painful to
> handle if you use the "open" statement : a bunch of "open" statements
> in a non-careful order and your infix operators become unusable
> because you don't know anymore where they come from. What you really
> need is some form of "explicit open", à la Python or Haskell, such as
> "from Int import (mod, of_char, to_char)" instead of the full open :
> only a few identifiers are unqualified, and you still use Int.(=),
> Int.(+) instead of polluting the global namespace.

If you're willing to explicitly name the things you wish to import
then this doesn't seem to be a hard problem to solve:

let mod = Int.mod
let of_char = Int.of_char
let to_char = Int.tochar

Or even, in 3.12,

let mod, of_char, to_char = Int.(mod, of_char, to_char)

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to