Re: automatically resolving open?

Jeremy Yallop <[email protected]> Wed, 23 Apr 2025 15:33:42 +0000
Newsgroups gmane.comp.lang.caml.inria
Message-ID <CAAxsn=EzXJAWsfx8GyNc9x+Q76m08nk3H1CvBNfmjSgt6R5E0g@mail.gmail.com>
On Wed, 23 Apr 2025 at 14:32, Francois Pottier
<[email protected]> wrote:
> open List
> module List = struct end
> let test = map (fun x -> x + 1) [1; 2; 3]

On Wed, 23 Apr 2025 at 14:46, Ivan Gotovchits <[email protected]> wrote:
> open struct let map f x = f x end
> let () = map (fun _ -> ()) 0

We could perhaps add structure-level substitutions to handle these
kinds of cases:

module L := List
module List = struct end
let test = L.map (fun x -> x + 1) [1; 2; 3]

module M := struct let map f x = f x end
let () = M.map (fun _ -> ()) 0

As in signatures, the idea would be that names like 'L' and 'M' bound
in this way would be internal-only, and would not appear in the
signature.