The syntax for namespaced maps was added to make working with namespaced keywords easier. However, while the combination of namespace aliases and namespaced maps allows concise source code, all namespaces are fully expanded in REPL output. To address this readability problem, I propose a *print-alias*
dynamic var that, when set to a truthy value, causes pr
to make use of (ns-aliases *ns*)
:
(set! *print-alias* true)
;;=> true
(require '[clojure.repl :refer [doc]]
'[clojure.spec :as s])
;;=> nil
(s/def ::some some?)
;;=> ::some
(doc ::some)
;; -------------------------
;; ::some
;; Spec
;; some?
;;=> nil
(s/conform ::some nil)
;;=> ::s/invalid
(s/explain-str ::some nil)
;;=> "val: nil fails spec: ::some predicate: some?\n"
(s/explain-data some? nil)
;;=> #::s{:problems [{:path [], :pred some?, :val nil, :via [::some], :in []}]}
I already have a working print-method
for clojure.lang.Keyword
; if it’s OK with everyone, I’ll finish modifying the print-method
for clojure.lang.IPersistentMap
and submit a patch to JIRA.
> an email to clojure-dev+unsubscribe@googlegroups.com
> <mailto:clojure-dev+unsub...@googlegroups.com>.
> To post to this group, send email to cloju...@googlegroups.com
> <mailto:clojure-dev@googlegroups.com>.
> Visit this group at https://groups.google.com/group/clojure-dev.
> For more options, visit https://groups.google.com/d/optout.
--
And what is good, Phaedrus,
And what is not good—
Need we ask anyone to tell us these things?
--
You received this message because you are subscribed to the Google Groups "Clojure Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure-dev+unsubscribe@googlegroups.com.
To post to this group, send email to cloju...@googlegroups.com.
I agree that the loss of information incurred by printing aliases is undesirable; that’s why I was proposing that *print-alias*
be set to false
by default. However, I’ll defer to your judgment about whether or not this should be in core Clojure.
> an email to clojure-dev...@googlegroups.com
> <mailto:clojure-dev+unsub...@googlegroups.com>.
> To post to this group, send email to cloju...@googlegroups.com
> <mailto:cloju...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/clojure-dev.
> For more options, visit https://groups.google.com/d/optout.
--
And what is good, Phaedrus,
And what is not good—
Need we ask anyone to tell us these things?
--
You received this message because you are subscribed to the Google Groups "Clojure Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure-dev...@googlegroups.com.