Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
interest in a much simpler, but modern, Caml?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-08-09 (13:10)
From: David House <dmhouse@g...>
Subject: Re: [Caml-list] interest in a much simpler, but modern, Caml?
On 8 August 2010 17:47, bluestorm <> 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 "" 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)