I would prefer if the compiler warns us if in expression `M.(x)` the value `x` is not in the scope of `M`.

Clarification: usually when we say `M.(x + cross y)` we want to use only values from module `M`
and problems arise when something is captured from outside the module. Such kind of local opens
are usually use to open rich modules, that fully defines an algebra of a type, i.e., a full suite of 
common operations like, comparison operations, arithmetics, etc. So, using local open is some kind
of local algebra switch operation. In other words switching to other domain specific language.

A good style would be to explicitly qualify every external value that is used inside the local opened scope:

M.(x * Vec.of_array [| 1; 2 |])


On Tue, Aug 4, 2015 at 8:26 AM, vrotaru.md@gmail.com <vrotaru.md@gmail.com> wrote:
After reading this thread, I'm starting to thinking about another option, namely: "local un-open", because I certainly dislike ambiguity.

So, maybe, something like:

Vec.( ^(3 * v) * vx + vy)

where anything in ^(... ) is not subject local open.

Regards


În Mar, 4 aug. 2015 la 12:40, Daniel Bünzli <daniel.buenzli@erratique.ch> a scris:
Le mardi, 4 août 2015 à 10:26, Goswin von Brederlow a écrit :
> > let ox = V2.((dot v ox) * ox) in
> > V2.(3 * ox + oy)
>
> What is wrong with that code?
>
> I'm assuming V2 has:
>
> val (+): t -> t -> t
> val (*): int -> t -> t
> val dot: t -> t -> int

It also has

val ox : t

Daniel



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