我已經在一個文件中定義mod.ml
模塊如下:定義模塊,並調用其功能在一個文件中
module Area = struct
...
let test : unit =
Print.printf "haha"
...
end;;
Print.printf "hehe";;
Area.test
似乎沒有;;
end
後,我不能ocamlc
編譯代碼。但是在Ocaml文件中有;;
,這讓我感到很奇怪,我必須保留它們嗎?
生成mod
ocamlc
後,我啓動mod
,它打印hahahehe
。看來haha
是由let test : unit ...
的定義而不是其呼叫Area.test
打印的。結果除了hehehaha
或hahahehehaha
。任何人都可以解釋爲什麼它不是我所期望的?