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
Leaking user-defined symbols from a parent scope to a module's scope can lead to subtle bugs. The module's scope should be as isolated from the parent scope as possible, but not completely (e.g., we still need basic Nushell commands like ls to be visible).
Could be partially addressed by introducing two new FrameTypes:
Barrier: Stops symbol lookup when traversing the scope stack. This prevents the symbol lookup from searching the parent scopes.
Prelude: With only Barrier, we'd lose “default” commands that we want to be visible (like ls). Perhaps we could have a Prelude frame type which would get initialized first during create_default_context() with these default commands.
The question is what to do with constants like NU_LIB_DIRS, e.g.,:
constNU_LIB_DIRS=$NU_LIB_DIRS|append'/home/spam/foo`module { use bar.nu # should it look for 'bar.nu' in '/home/spam/foo'?}
We might want to decide on this based on the envisioned functionality of how nupm is supposed to use overlays as “virtual environments”, relying on modifying the NU_LIB_DIRS constant.
The text was updated successfully, but these errors were encountered:
Leaking user-defined symbols from a parent scope to a module's scope can lead to subtle bugs. The module's scope should be as isolated from the parent scope as possible, but not completely (e.g., we still need basic Nushell commands like
ls
to be visible).Could be partially addressed by introducing two new
FrameType
s:Barrier
: Stops symbol lookup when traversing the scope stack. This prevents the symbol lookup from searching the parent scopes.Prelude
: With only Barrier, we'd lose “default” commands that we want to be visible (likels
). Perhaps we could have a Prelude frame type which would get initialized first duringcreate_default_context()
with these default commands.The question is what to do with constants like
NU_LIB_DIRS
, e.g.,:We might want to decide on this based on the envisioned functionality of how nupm is supposed to use overlays as “virtual environments”, relying on modifying the
NU_LIB_DIRS
constant.The text was updated successfully, but these errors were encountered: