Hello all,
Peval's potential (and that of the optimizer in general) will be
significantly reduced if it cannot inline top-level variable references.
It seems to me that there's a way to enjoy the benefits of both
optimization and dynamism at the same time.
I propose that we allow code to declare that a given top-level variable
is "rarely-mutated". Semantically, this would give Guile permission to
use a representation of the variable for which mutations are very
expensive, in the hope that references can be made much cheaper.
Rarely-mutated variables would be treated as constants by the optimizer.
However, associated with each rarely-mutated variable would be a list of
compiled code segments that have inlined its value.
Then when a rarely-mutated variable is set!, the associated list of
compiled code segments would be immediately invalidated. Obviously,
this would require an implementation of on-stack replacement.
What do you think?
Mark