>> C. Set all variables in the C environment to match process-environment
>> every time we call into the dynamic module
>> (but this is slow and hurts performance)
I'm
going to preface a solution to excessive redundant passing by pointing
out that the provenance of a piece of data is a requisite but something
we don't have.
Encoding input provenance in vector clocks is a solution to avoiding
unnecessary passing and maintaining caller and callee input
synchronization even when the callee is performing asynchronous work.
While we can use watch-variable for updates from Elisp, such as those done by a package like envrc that creates buffer local environments, updates from C
don't have this convenience.
Protecting inputs from arbitrary
mutations is a requirement to implement this technique conveniently. More likely, there need to be interfaces that permit a logical clock and the value it versions to remain consistent. Since the data needs to be immutable or else requires locking, coordination with the GC is required.