https://facebook.github.io/reason/modules.html#modules-basic-modules原因模塊系統
I don’t see any import or require in my file; how does module resolution work?
Reason/OCaml doesn’t require you to write any import; modules being referred to in the file are automatically searched in the project. Specifically, a module Hello asks the compiler to look for the file hello.re or hello.ml (and their corresponding interface file, hello.rei or hello.mli, if available).
A module name is the file name, capitalized. It has to be unique per project; this abstracts away the file system and allows you to move files around without changing code.
我想原因模塊系統,但無法理解它是如何工作的。
1)open
和include
之間有什麼不同?
2)我有文件foo.re
與定義的模塊Foo
。我有文件bar.re
並想從模塊Foo
調用功能。
應該我open
或include
模塊Foo
在bar.re
?或者直接訪問 - Foo.someFunction
?
3)模塊接口只能實現*.rei
文件?和模塊接口文件應該是相同的名稱,但與rei
分機?