My folder contains several files that are compiled in the following order: global.ml, zone.ml, abs.ml,main.ml
global.mlcontains some reference variables (e.g. let g1 = ref 0) for all files.
There zone.mlis an announcement let f = !g1.
In abs.mlthere g1 := 5, which will be launched mainat the beginning of the execution, I consider it to be initialization g1, given the real context of the runtime.
Will maincall later Zone.f. Curiously, I understand what f = 5is required instead f = 0.
Do you think this is normal behavior? If so, what should I change so that it takes into account the current value !g1?
PS: Perhaps one solution is to create a function let f v = vin zone.ml, and then a maincall Zone.f !g1. But I have several global reference variables as g1in global.ml, I hope that they can be valid for all files and functions, and I do not want them to participate in the function signature.
source
share