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
Implement the Needs rule forms and $ContextAliases
`Needs["ctx`" -> "alias`"]` records the alias in `$ContextAliases` and
`Needs["ctx`" -> None]` records nothing; both leave `$ContextPath` exactly
as they found it, undoing what the read file did to it. An alias stands for
its context wherever the context's own name could appear: in a symbol, and
in a `Names` or `Contexts` pattern. The alias is registered as soon as the
rule has been read — so a call that goes on to fail on its second argument
keeps it — and taken back out, restoring any previous target, when the load
produces no context. `$ContextAliases::cxinuse` and `::cxconflict` are
re-checked on every write to the mapping, as wolframscript does.
Fixes found on the way there:
- `$Path` was ignored: `Needs`, `Get` and `FindFile` searched a hardcoded
list, so `AppendTo[$Path, dir]` had no effect.
- `$ContextPath` was dual-sourced — assignments landed in the variable
store while resolution read a separate stack, so which one answered
depended on who asked.
- A part assignment to a system variable that only had a built-in default
defined a down-value instead of extending the value.
- A list literal of `$…` variables (`{$Version}`) was echoed verbatim by
`interpret`'s fast path instead of being evaluated.
- `clear_symbol_table` was never called, so the context symbol table
survived `clear_state`.
- `ComputerArithmetic`` — the reference page's own example — was missing
from the standard-distribution contexts.
Copy file name to clipboardExpand all lines: functions.csv
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -249,7 +249,7 @@ Sort,Sorts a list in ascending order or by an ordering function which leaves a p
249
249
Series,Computes a power series expansion about a point or at Infinity,✅,pure,1.0,195
250
250
Return,Returns a value from a definition body Do or Scan — anywhere else it stands as Return[value] and is collected like any other,✅,pure,1.0,196
251
251
Appearance,Option symbol for specifying visual appearance,✅,pure,6.0,197
252
-
Needs,Loads the file providing a context from a loaded paclet directory or from $Path,✅,effectful,1.0,198
252
+
Needs,Loads the file providing a context from a loaded paclet directory or from $Path; a rule right-hand side aliases the context in $ContextAliases or (None) records nothing,✅,effectful,1.0,198
253
253
Center,Symbol for centering alignment,✅,pure,1.0,199
0 commit comments