under ocaml version 4.10.1
Here is a faked list.ml
let x = 3
I have a file called test.ml sitting in the same directory
List.length [1;2;3]
First, I compile my local list.ml using ocamlc -c list.ml
.
Now I compile ocamlc -c test.ml
, it comes with an error as expected:
File "test.ml", line 3, characters 0-11:
3 | List.length [1;2;3]
^^^^^^^^^^^
Error: This expression has type int
This is not a function; it cannot be applied.
Now I do ocamlc -open Stdlib -I . -c test.ml
and ocamlc -I . -open Stdlib -c test.ml
both compiles, my confusion is that why shadowing does not work here? (My original understanding is that the ocaml compiler did -open Stdlib
behind the scene, but it seems more than that)
Thanks