是否有可能let
绑定(无论是函数,值等)是其模块的[[私有,并且在外部不可见?
A.ml
:let exported = 1
let local = 2
我只希望可以从其他模块访问exported
。B.ml
:
let a = A.exported let error = A.local (* This should error *)
(* A.ml *)
let exported = 1
let local = 2
和
(* A.mli *) val exported: int
然后只有exported
在A.ml
之外可见。