This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-06-28
Channels
- # babashka (10)
- # beginners (140)
- # cider (6)
- # clj-kondo (10)
- # cljs-dev (39)
- # cljsrn (6)
- # clojars (1)
- # clojure (23)
- # clojure-europe (2)
- # clojure-spec (7)
- # clojure-uk (6)
- # clojurescript (1)
- # conjure (16)
- # cursive (3)
- # datomic (3)
- # emacs (6)
- # fulcro (13)
- # graalvm (3)
- # malli (8)
- # meander (4)
- # off-topic (43)
- # pathom (1)
- # pedestal (15)
- # re-frame (13)
- # reagent (3)
- # sci (25)
- # shadow-cljs (26)
- # sql (9)
- # testing (34)
- # tools-deps (80)
Heya! I’m playing with an experiment to to interpret rewrite-cljc tests via natively compile sci+rewrite-cljc src (thanks for the idea @borkdude). Here’s an interesting thing: rewrite-cljc automatically coerces Clojure to rewrite-cljc nodes. I think sci is sometimes including metadata on args from read time? Maybe? For example, on call (rewrite-cljc.zip/replace zloc [5 6 7])
, arg [5 6 7]
is adorned with sci metadata {:line 16 :column 35 :end-line 16 :end-column 42}
which rewrite-cljc sees as metadata and converts it to to meta node instead of a vector node.
> Here’s an interesting thing: rewrite-cljc automatically coerces Clojure to rewrite-cljc nodes.
the coercing magic happens in https://github.com/lread/rewrite-cljc-playground/blob/master/src/rewrite_cljc/node/coercer.cljc
or maybe you could strip that metadata within sci yourself, just with walk and vary-meta
If we could clearly tell that the metadata belonged to sci (or edamame), a general solution could selectively strip it.
@lee Note that Clojure itself also puts metadata on things:
user=> (meta '(list 1 2 3))
{:line 1, :column 8}
Sci might put metadata on more things than Clojure. Maybe Clojure only puts them on lists.
meta is also coercible in rewrite-cljc so not sure how I’d distinguish. I’ll poke around.
maybe you can override the sci metadata with your own values so the test is the same in sci and clj?
That doesn't work:
$ bb "(meta ^{:line 666} '(list 1 2 3))"
{:line 1, :column 7, :end-line 1, :end-column 33}