I’m trying to understand closure compilation … from the ocaml source.
in [Closure.close_functions] there is this:
if !useless_env && occurs_var env_param ubody then raise NotClosed;
prior to this the cenv is populated with accesses to the env_param for each free variable identified from all fundefs.
I assume having been identified as such each is going to appear at least once somewhere in the fundef bodies.
therefore the above occurs check is going to hit for one fundef or another.
my question is why is fv<> not a condition for intially_closed/usless_env to be false from the outset and avoid the second round of compilation
when the exception is raised.
I believe I’m misunderstanding something though and help appreciated!