dollabs / pamela

Probabalistic Advanced Modeling and Execution Learning Architecture
Apache License 2.0
233 stars 13 forks source link

Change pamela.utils/*dbg-println-level* to an atom #117

Closed tmarble closed 7 years ago

tmarble commented 7 years ago

Currently changing the *dbg-println-level* requires changing namespaces:

pamela.cli> (in-ns 'pamela.utils)
#namespace[pamela.utils]
pamela.utils> (def *dbg-println-level* 1)
Warning: *dbg-println-level* not declared dynamic and thus is not dynamically rebindable, but its name suggests otherwise. Please either indicate ^:dynamic *dbg-println-level* or change the name. (*cider-repl pamela*:3061)
#'pamela.utils/*dbg-println-level*
pamela.utils> (in-ns 'pamela.cli)
#namespace[pamela.cli]
pamela.cli> pamela.utils/*dbg-println-level*
1

It would be nice if this were defined as an atom (no longer requires being dynamic) that could be mutated from any namespace with a function like (pamela.utils/set-dbg-println-level 6).

pmdoll commented 7 years ago

What are the consequences of this change?

tmarble commented 7 years ago

@pmdoll the consequence is that it should be much easier to change the dbg-println level on the REPL, like this: pamela.cli> (pamela.utils/set-dbg-println-level 6)

That function will mutate the atom held in the var and the macro that uses it will deref the atom instead of using the value of the var itself.

pmdoll commented 7 years ago

Seems like a trivial change.

dcerys commented 7 years ago

Sure, I'll make this change. In the interim, it's easy to change the value in a Cider buffer (for parser.clj), and do C-M-X (which is actually far less typing than calling (pamela.utils/set-dbg-println-level 6))

“For my ally is the Force [emacs and Cider], and a powerful ally it is.”