This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-06-06
Channels
- # announcements (1)
- # beginners (147)
- # boot (9)
- # calva (28)
- # cider (3)
- # circleci (18)
- # cljdoc (54)
- # cljs-dev (55)
- # cljsrn (22)
- # clojure (179)
- # clojure-canada (9)
- # clojure-dev (74)
- # clojure-europe (1)
- # clojure-italy (15)
- # clojure-nl (7)
- # clojure-spec (30)
- # clojure-uk (55)
- # clojurescript (65)
- # core-async (15)
- # cursive (12)
- # datomic (16)
- # events (4)
- # fulcro (25)
- # graalvm (3)
- # joker (2)
- # kaocha (15)
- # keechma (94)
- # off-topic (12)
- # qlkit (2)
- # re-frame (15)
- # reagent (11)
- # reitit (29)
- # remote-jobs (15)
- # rewrite-clj (16)
- # shadow-cljs (73)
- # spacemacs (151)
- # sql (3)
- # tools-deps (11)
- # unrepl (19)
- # vim (35)
@lee sounds great! Were you asking because it wasn't quite obvious what I had in mind?
@lee you can use clj-kondo for this, I could explain how. but since this is not part of a public contract, I haven’t documented this anywhere 😉
@lee quick REPL session:
$ clj
Clojure 1.10.0
user=> (require '[clj-kondo.impl.cache :as cache])
nil
user=> (require '[clj-kondo.core :as clj-kondo])
user=> (clj-kondo/run! {:lint ["/tmp/rewrite-clj/src"] :cache "/tmp/rewrite-clj"})
...
user=> (clj-kondo/run! {:lint ["/tmp/rewrite-cljs-playground/src"] :cache "/tmp/playground"})
...
user=> (cache/from-cache "/tmp/rewrite-clj/2019.06.02-alpha-SNAPSHOT" :clj ['rewrite-clj.parser.core])
{rewrite-clj.parser.core {dispatch {:fixed-arities #{1}, :private? true, :ns rewrite-clj.parser.core, :name dispatch, :base-lang :clj, :lang :clj, :col 1, :row 17}, parse-next {:fixed-arities #{1}, :ns rewrite-clj.parser.core, :name parse-next, :base-lang :clj, :lang :clj, :col 1, :row 33}, parse-delim {:fixed-arities #{2}, :private? true, :ns rewrite-clj.parser.core, :name parse-delim, :base-lang :clj, :lang :clj, :col 1, :row 39}, parse-printables {:private? true, :ns rewrite-clj.parser.core, :name parse-printables, :base-lang :clj, :var-args-min-arity 3, :lang :clj, :col 1, :row 46}, :source :disk}}
user=> (cache/from-cache "/tmp/playground/2019.06.02-alpha-SNAPSHOT" :cljc ['rewrite-clj.parser.core])
{rewrite-clj.parser.core {:clj {dispatch {:fixed-arities #{1}, :private? true, :ns rewrite-clj.parser.core, :name dispatch, :base-lang :cljc, :lang :clj, :col 1, :row 16}, parse-next {:fixed-arities #{0}, :ns rewrite-clj.parser.core, :name parse-next, :base-lang :cljc, :lang :clj, :col 1, :row 32}, parse-delim {:fixed-arities #{1}, :private? true, :ns rewrite-clj.parser.core, :name parse-delim, :base-lang :cljc, :lang :clj, :col 1, :row 38}, parse-printables {:private? true, :ns rewrite-clj.parser.core, :name parse-printables, :base-lang :cljc, :var-args-min-arity 2, :lang :clj, :col 1, :row 45}}, :cljs {dispatch {:fixed-arities #{1}, :private? true, :ns rewrite-clj.parser.core, :name dispatch, :base-lang :cljc, :lang :cljs, :col 1, :row 16}, parse-next {:fixed-arities #{1}, :ns rewrite-clj.parser.core, :name parse-next, :base-lang :cljc, :lang :cljs, :col 1, :row 32}, parse-delim {:fixed-arities #{2}, :private? true, :ns rewrite-clj.parser.core, :name parse-delim, :base-lang :cljc, :lang :cljs, :col 1, :row 38}, parse-printables {:private? true, :ns rewrite-clj.parser.core, :name parse-printables, :base-lang :cljc, :var-args-min-arity 3, :lang :cljs, :col 1, :row 45}}, :source :disk}}
using the last two values, you could e.g. use https://github.com/lambdaisland/deep-diff to find differences
please note that the cache namespace in clj-kondo is an implementation detail and might break in a future version 😉
A similar approach could be taken with the data in cljdoc but that's still a bit hard to get to unless you're willing to add this to cljdoc directly
We should really get this API thing worked out 🙂
Did you start work on this yet? I think you were leaning toward a new separate repo to extract publics? Need a hand?
I didn't start working on an API yet. Not sure what you mean with the separate repo and how that would be related?
Oops, we might be talking about different things. I’m referring to the cljdoc fork of codox. My memory is fuzzy but I thought you were considering moving away from the codox fork and creating a stand-alone project https://github.com/cljdoc/codox/pull/1#issuecomment-490548935
actually it looks like a stand-alone project is my assumption, you did not explicitly mention doing that.
but it seems like a good idea. A single purpose project that could be reused by maybe even codox master.
yes I was thinking of doing that
hands welcome for sure, I simply didn't get to it so far
I also thought that I had a branch with some modifications in that direction but I can't find that right now
I think you expressed some goals in our discussion https://github.com/cljdoc/codox/pull/1 I suppose extracting these to an adr might make sense.
whoops, I thought I already merged that PR, sorry for taking so long on this!
oh yeah, that's what I'd love to see
but then it would maybe not work for libraries that are forks and renamed versions of others
like a "mechanical changelog" where you can compare two versions of the same lib and you see the (obvious) API differences (changed arities etc)
yeah, but in lread’s case he’s doing a reworked version of some other library he’s trying to remain compatible with
ah right, that's a bit of a different thing
yeah, or an API so people can do whatever 🙂
@lee yeah, for one-off things it’s pretty easy to make a script out of it for your use case
my original thought was, as @martinklepsch was suggesting, to look at publics via analyzers like cljdocs version of codox does. I thought this might work better because rewrite-clj makes use of a version of potemkin (hotly debated) import-vars.
It always comes back to import-vars
😄
I have created a version of import-vars for cljs within my rewrite-clj/rewrite-clj merge effort. I did it as a learning effort but since the concept is so contentious I questioned myslef often. 😬 It also led me here to cljdoc because the cljdoc codox fork needed to be updated to support cljs import-vars.
@borkdude, I didn’t occur to me that it might not, I am using cljs analyzer to do the import-vars magic.
it could work, just something to be aware of. also I’d test if it works under self-hosted CLJS (e.g. Planck or Lumo)