Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Eliminate ManyVarsDynamicScope as much as possible #5694
ManyVarsDynamicScope is our in-place growable DynamicScope, usually used for evals against scopes that need to accommodate additional variables over time. Nearly all other normal scopes will use the right-sized generated DynamicScope subclasses. These are better in almost every case for various reasons:
We are still using ManyVarsDynamicScope in a number of places where we probably don't need to:
For the cases that really do not need a ManyVarsDynamicScope, it seems like an obvious move to go with the right-sized DynamicScope class.
For cases that do need to grow, I would propose that we still can use right-sized scopes, since variables added by subsequent evals again only need to grow the static scope. Then if it turns out we've got a too-small DynamicScope in hand, we request the larger one, copy values over, and proceed. Very few evals introduce new variables over time.