-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow assignment to globals in other modules #23295
Comments
These should be specified using an IOContext
The primary recommended alternative (which is missing from your list) is to eschew globals in favor of using locally scoped constructs (aka local variables / arguments) But since there's already a number of ways to do this, (notably |
This can always be allowed later, so I would not be in a hurry to do this. |
TIL, thank you. AFAICT, there is no way to permanently specify a value (eg. the color of some object's pretty-printing) when it would be tiring and redundant to specify it to print each object in the REPL. (#20509) If I have a deeply-nested Common Lisp has the following built-in global variables, in addition to vendor-specific extensions: *break-on-signals* *compile-file-pathname* *compile-file-truename* *compile-print*
*compile-verbose* *debug-io* *debugger-hook* *default-pathname-defaults* *error-output*
*features* *gensym-counter* *load-pathname* *load-print* *load-truename* *load-verbose*
*macroexpand-hook* *modules* *package* *print-array* *print-base* *print-case* *print-circle*
*print-escape* *print-gensym* *print-length* *print-level* *print-lines* *print-miser-width*
*print-pprint-dispatch* *print-pretty* *print-radix* *print-readably* *print-right-margin*
*query-io* *random-state* *read-base* *read-default-float-format* *read-eval* *read-suppress*
*readtable* *standard-input* *standard-output* *terminal-io* *trace-output* I can get, set, or temporarily change (dynamic scope) each of these with |
On second thought, if #20509 is implemented, that would cover most of my use cases. |
Fixed by #44137, AFAICT. |
Currently,
SomeModule.variable = 5
yieldscannot assign variables in other modules
. I get that globals aren't recommended in general, but they are occasionally convenient for specifying things like verbosity level, or the color of the output. Could we allow them, when qualified with the module? The alternatives (Ref
/accessors) are a bit verbose.The text was updated successfully, but these errors were encountered: