elvish/pkg/eval
Qi Xiao 363b712f66 pkg/eval: Eliminate in-place mutations of *Ns.
This commit replaces scopeOp, the only remaining place that mutates *Ns in
place, with nsOp, which performs copy-on-write for *Ns.

As a result, the "eval" command no longer mutates the passed namespace. The
default namespace it uses is also changed to match the default of "-source" (an
amalgamated namespace from the local and upvalue scopes), making "-source $file"
equivalent to "eval (slurp <$file)", and formally deprecated.

Another result is that (*Evaler).Eval can now guard the mutation of the global
namespace with the mutex, making it concurrency-safe to execute multiple sources
that touch the global namespace.

This fixes #1137.
2021-01-09 15:02:15 +00:00
..
errs pkg/eval/errs: Change OutOfRange.Valid{Low High} to strings. 2020-08-18 21:23:26 +01:00
evaltest pkg/eval: Make Exception an interface. 2021-01-08 00:56:45 +00:00
mods pkg/eval: Remove (*Ns).Append. 2021-01-05 01:09:04 +00:00
vals pkg/eval: Update comments about the Elvish-Go interface. 2021-01-05 05:23:28 +00:00
vars pkg/eval: Cleanups for reducing the API surface area number of files. 2021-01-05 04:33:52 +00:00
args_walker.go pkg/parse: Turn most public methods of Node into functions. 2020-04-25 18:55:44 +01:00
benchmarks_test.go pkg/eval: Clean up the structure and methods of Evaler and Frame. 2021-01-05 00:22:09 +00:00
builtin_fn_cmd_test.go pkg/eval: Move test framework into new evaltest package. 2020-09-03 06:51:21 +01:00
builtin_fn_cmd_unix_test.go pkg/eval/evaltest: Consolidate all the Throws* methods into one. 2020-09-04 20:31:47 +01:00
builtin_fn_cmd_unix.go pkg/eval: Make Exception an interface. 2021-01-08 00:56:45 +00:00
builtin_fn_cmd_windows.go Change signature of "exec" and "fg" on Windows to match that on Unix. 2020-12-26 22:59:18 +00:00
builtin_fn_cmd.go pkg/eval: Cleanups for reducing the API surface area number of files. 2021-01-05 04:33:52 +00:00
builtin_fn_container_test.go pkg/eval/evaltest: Consolidate all the Throws* methods into one. 2020-09-04 20:31:47 +01:00
builtin_fn_container.go Implement namespaces using slices instead of maps. 2020-12-25 17:46:46 +00:00
builtin_fn_debug.go pkg/eval: Use exported methods to access ports from builtin functions. 2020-10-10 22:28:13 +01:00
builtin_fn_env_test.go pkg/eval/evaltest: Consolidate all the Throws* methods into one. 2020-09-04 20:31:47 +01:00
builtin_fn_env.go pkg/eval: Move test framework into new evaltest package. 2020-09-03 06:51:21 +01:00
builtin_fn_flow_test.go pkg/eval/evaltest: Consolidate all the Throws* methods into one. 2020-09-04 20:31:47 +01:00
builtin_fn_flow.go Make all builtin functions and subnamespaces read-only. 2021-01-09 00:41:42 +00:00
builtin_fn_fs_test.go pkg/eval/evaltest: Move Must* functions to the testutil package. 2020-09-04 21:57:20 +01:00
builtin_fn_fs.go pkg/eval: Clean up the structure and methods of Evaler and Frame. 2021-01-05 00:22:09 +00:00
builtin_fn_io_test.go pkg/eval/evaltest: Consolidate all the Throws* methods into one. 2020-09-04 20:31:47 +01:00
builtin_fn_io.go pkg/eval: Break up value.go. 2020-10-10 22:28:13 +01:00
builtin_fn_misc_test.go pkg/eval: Eliminate in-place mutations of *Ns. 2021-01-09 15:02:15 +00:00
builtin_fn_misc_unix_test.go Deflake the test against "sleep" by delaying the SIGINT slightly. 2021-01-02 01:49:40 +00:00
builtin_fn_misc.go pkg/eval: Eliminate in-place mutations of *Ns. 2021-01-09 15:02:15 +00:00
builtin_fn_num_test.go pkg/eval/evaltest: Consolidate all the Throws* methods into one. 2020-09-04 20:31:47 +01:00
builtin_fn_num.go pkg/eval: Clean up the structure and methods of Evaler and Frame. 2021-01-05 00:22:09 +00:00
builtin_fn_pred_test.go Fix typos found by codespell 2020-10-10 22:47:50 +01:00
builtin_fn_pred.go pkg/eval: Update doc of the "not" command. 2020-12-25 17:46:09 +00:00
builtin_fn_str_test.go pkg/eval/evaltest: Consolidate all the Throws* methods into one. 2020-09-04 20:31:47 +01:00
builtin_fn_str.go pkg/eval: Use exported methods to access ports from builtin functions. 2020-10-10 22:28:13 +01:00
builtin_fn_styled_test.go In prompts implicitly coerce float64 to string 2020-12-25 17:34:49 +00:00
builtin_fn_styled.go Trivial documentation consistency change 2020-12-25 17:43:32 +00:00
builtin_ns.go pkg/eval: Cleanups for reducing the API surface area number of files. 2021-01-05 04:33:52 +00:00
builtin_special_test.go Fix definition of recursive functions with fn. 2021-01-03 20:44:52 +00:00
builtin_special.go pkg/eval: Eliminate in-place mutations of *Ns. 2021-01-09 15:02:15 +00:00
callable.go pkg/eval: Break up value.go. 2020-10-10 22:28:13 +01:00
chdir_test.go Improve navigation mode corner cases 2020-11-07 13:17:00 -05:00
closure_test.go pkg/eval: Clean up closure call implementation. 2021-01-04 13:46:00 +00:00
closure.go pkg/eval: Minor cleanups. 2021-01-05 16:05:34 +00:00
compile_effect_test.go Fix hang reading value channel from a redirection 2020-11-07 13:52:29 -05:00
compile_effect_unix_test.go pkg/eval/evaltest: Move Must* functions to the testutil package. 2020-09-04 21:57:20 +01:00
compile_effect.go pkg/eval: Eliminate in-place mutations of *Ns. 2021-01-09 15:02:15 +00:00
compile_lvalue_test.go pkg/eval: Move test framework into new evaltest package. 2020-09-03 06:51:21 +01:00
compile_lvalue.go pkg/eval: Change all the *Op types to return Exception instead of error. 2021-01-09 00:25:32 +00:00
compile_value_test.go pkg/eval: Change all the *Op types to return Exception instead of error. 2021-01-09 00:25:32 +00:00
compile_value.go pkg/eval: Change all the *Op types to return Exception instead of error. 2021-01-09 00:25:32 +00:00
compiler.go pkg/eval: Eliminate in-place mutations of *Ns. 2021-01-09 15:02:15 +00:00
deprecation.go pkg/eval: Add mutex to Evaler, and remove that of deprecationRegistry. 2021-01-04 15:55:26 +00:00
eval_test.go pkg/eval: Minor cleanups. 2021-01-05 16:05:34 +00:00
eval.go pkg/eval: Eliminate in-place mutations of *Ns. 2021-01-09 15:02:15 +00:00
exception_test.go pkg/eval: Make Exception an interface. 2021-01-08 00:56:45 +00:00
exception_unix_test.go pkg/eval: Move test framework into new evaltest package. 2020-09-03 06:51:21 +01:00
exception.go pkg/eval: Make Exception an interface. 2021-01-08 00:56:45 +00:00
external_cmd_test.go pkg/eval: Cleanups for reducing the API surface area number of files. 2021-01-05 04:33:52 +00:00
external_cmd_unix_test.go pkg/eval: Move EachExternal to the fsutil package. 2020-09-04 22:04:20 +01:00
external_cmd_windows_test.go pkg/eval: Move test framework into new evaltest package. 2020-09-03 06:51:21 +01:00
external_cmd.go pkg/eval: Cleanups for reducing the API surface area number of files. 2021-01-05 04:33:52 +00:00
frame.go pkg/eval: Eliminate in-place mutations of *Ns. 2021-01-09 15:02:15 +00:00
glob_test.go pkg/eval/evaltest: Move Must* functions to the testutil package. 2020-09-04 21:57:20 +01:00
glob.go pkg/eval: Cleanups for reducing the API surface area number of files. 2021-01-05 04:33:52 +00:00
go_fn_test.go pkg/eval: De-export GoFn. 2020-09-04 22:30:42 +01:00
go_fn.go pkg/eval: Update comments about the Elvish-Go interface. 2021-01-05 05:23:28 +00:00
interrupts.go pkg/eval: Remove (*Evaler).EvalInTTY. 2020-04-16 00:11:23 +01:00
must.go pkg: Fix small issues found by staticcheck. 2020-04-13 13:56:10 +01:00
ns_test.go Make all builtin functions and subnamespaces read-only. 2021-01-09 00:41:42 +00:00
ns.go Make all builtin functions and subnamespaces read-only. 2021-01-09 00:41:42 +00:00
options_test.go Increase options.go coverage to 100% 2020-08-26 20:40:22 +01:00
options.go pkg/eval: Update comments about the Elvish-Go interface. 2021-01-05 05:23:28 +00:00
port_helper_test.go pkg/eval: Clean up the structure and methods of Evaler and Frame. 2021-01-05 00:22:09 +00:00
port.go pkg/eval: Clean up Port related code. 2021-01-05 05:23:17 +00:00
process_unix.go
process_windows.go
purely_eval_test.go pkg/eval: Remove (*Ns).Append. 2021-01-05 01:09:04 +00:00
purely_eval.go pkg/eval: Clean up the structure and methods of Evaler and Frame. 2021-01-05 00:22:09 +00:00
pwd_test.go pkg/eval: Cleanups for reducing the API surface area number of files. 2021-01-05 04:33:52 +00:00
pwd.go pkg/eval: Cleanups for reducing the API surface area number of files. 2021-01-05 04:33:52 +00:00
value_test.go pkg/eval: Make Exception an interface. 2021-01-08 00:56:45 +00:00
var_parse_test.go pkg/eval: Various cleanups for qname handling code. 2020-12-25 22:31:52 +00:00
var_parse.go pkg/eval: Various cleanups for qname handling code. 2020-12-25 22:31:52 +00:00
var_ref.go Move pkg/eval/resolve.go to pkg/edit, and add more introspection methods on *Ns. 2021-01-05 15:43:26 +00:00