replete-repl / replete-shared

Shared ClojureScript code for Replete
Eclipse Public License 1.0
12 stars 3 forks source link

Abbreviate var and keywords when printing #16

Closed mfikes closed 5 years ago

mfikes commented 5 years ago

Simplify the printing of vars and keywords, abbreviating them relative to the current namespace.

This makes things more readily fit on mobile screens, and is simpler for new users who haven't yet been exposed to the concept of namespaces.

So for example, a def of a var prints in a simpler way:

(defn square [x]
 (* x x))
#'square

Likewise, if you evaluate, say ::foo, you will see ::foo printed.

This PR also handles the same idea in namespace maps,

{::foo 1 ::bar 2 ::baz {::quux 3}}

prints as

#::{:foo 1, :bar 2, :baz #::{:quux 3}}

instead of the more verbose

#:cljs.user{:foo 1, :bar 2, :baz #:cljs.user{:quux 3}}
wildthink commented 5 years ago

I'm not sure I have a strong opinion on this.

mfikes commented 5 years ago

OK, gonna merge this. I've been trying it out and it seems OK. If we find any serious issues we can revisit.