Crazy OCaml dynamic evaluation: is this legal (defined behaviour)?

Haha, yes, exactly - I was planning on generating a custom evaluation function each time I had a new evaluation context, however…

Good point - thanks for the pointer - you’re entirely correct, the use of an object for the environment is actually pretty overkill. I guess I can write a single evaluator function in the host context, no dynamic evaluation, and just defer handling environment variables to it.

I’m curious if anyone in the OCaml community could give some more advice on this.