You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be useful to be able to contextualize - ie, make available as defined constants - certain variables for specific evaluations.
A few viable approaches:
A new RAII type that represents a constant defined in an Env, "undefining" it on destruction.
Gotchas: lifetime and dangling references. (Since the type would need to store a reference to Env.)
Env storing a pointer to a parent, delegating symbol lookup to it if not found in its own table. The transient variables would be defined in a child Env which would be used for desired evaluations.
Gotchas: while root Env should define builtins in its constructor, child ones shouldn't. Solution: separate root and child Envs into distinct (related) types; leverage inheritance for code reuse.
The text was updated successfully, but these errors were encountered:
It would be useful to be able to contextualize - ie, make available as defined constants - certain variables for specific evaluations.
A few viable approaches:
Env
, "undefining" it on destruction.Env
.)Env
storing a pointer to a parent, delegating symbol lookup to it if not found in its own table. The transient variables would be defined in a childEnv
which would be used for desired evaluations.Env
should define builtins in its constructor, child ones shouldn't. Solution: separate root and childEnv
s into distinct (related) types; leverage inheritance for code reuse.The text was updated successfully, but these errors were encountered: