This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-11-12
Channels
- # adventofcode (2)
- # aleph (2)
- # announcements (5)
- # aws (5)
- # babashka (25)
- # beginners (167)
- # calva (8)
- # cider (1)
- # clj-kondo (3)
- # cljsrn (19)
- # clojure (87)
- # clojure-conj (7)
- # clojure-dev (19)
- # clojure-europe (1)
- # clojure-italy (14)
- # clojure-losangeles (1)
- # clojure-nl (4)
- # clojure-norway (3)
- # clojure-spec (18)
- # clojure-uk (29)
- # clojuredesign-podcast (3)
- # clojurescript (40)
- # clojurex (11)
- # core-async (13)
- # core-logic (2)
- # cursive (16)
- # data-science (4)
- # datascript (10)
- # datomic (53)
- # emacs (1)
- # events (15)
- # fulcro (71)
- # jobs (1)
- # jvm (2)
- # malli (4)
- # nrepl (2)
- # pathom (74)
- # re-frame (1)
- # reitit (19)
- # remote-jobs (1)
- # rewrite-clj (18)
- # ring (2)
- # shadow-cljs (132)
- # spacemacs (22)
- # tools-deps (65)
Hmm. One problem with nesting REPLs that way is that your evaluation->return ends up offset by one unless upon starting the nested REPL fires out a fake :ret
in order to pretend it's completed.
Ah, but :form
lets you relate them somewhat. Interesting.
Would it make sense for REPLs to bind *file*
, etc. to a thread local so that clients can do something like:
(set! *file* "/tmp/foo.clj") (set! *line-number* 84)
(defn foo [])
Or maybe just *in*
so that tools can rebind that with a pushback reader that has the line numbers set.user=> ^{:clojure.core/eval-file "foo.clj" :line 20 :column 3} 1
Syntax error reading source at (REPL:9:0).
Metadata can only be applied to IMetas
It does require you to pre-read to know whether you can apply meta or not :thinking_face:Good example of that is that I could extend IMeta to work on numbers (if I was a madman or something), and then parsing wouldn't work.
(if (and i-have-messed-with-the-source? (= :read-source (:clojure.error/phase (ex-data *e))))
(do (restore *e old*e) (send-original))
(display-error *e)
Alternatively, read
/LispReader could take an opt for ignoring invalid metadata on things, or something like that.
https://github.com/clojure/clojure/blob/28b87d53909774af28f9f9ba6dfa2d4b94194a57/src/jvm/clojure/lang/LispReader.java#L963 couldn't this line make that decision?
elseif (opts.dropLocationMeta && onlyHasLocationMeta(meta)){ return o }
Something like that?
That works pretty well for tooling, because it would still support chained meta ^{:line 10} ^:foo o
would either blow up or not, dependent on whether it should.