Clojurians
#cljs-dev
<
2018-07-30
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

martinklepsch11:07:02

cljs.analyzer.api/ns-publics returns macros with additional &form & &env arguments — if anyone has a moment could you explain why that is and if these arguments might be relevant for user-facing documentation in any way?

martinklepsch11:07:10

Specifically I’m using codox (with some mods) to read ns publics. The current setup returns macros twice, once as returned by cljs.analyzer.api and once read from the Clojure side

martinklepsch11:07:31

I’m trying to work out which of these two are more appropriate to use as input for documentation

mfikes11:07:59

Some macros are in core.cljc solely for self-hosted. One recent change (for doto) illustrates that it is there only so that it has a docstring relevant to ClojureScript / JavaScript.

martinklepsch11:07:21

Oh, I’m asking for any cljs/c code not just core. Not sure if that makes a difference?

martinklepsch11:07:22

Are macros that are returned by ns-publics generally the versions for self hosted?

dnolen12:07:34

@martinklepsch you need to clarify a bit what you mean

dnolen12:07:58

do you mean the analysis map has extended :arglists?

martinklepsch12:07:24

yes pretty much. I’m unsure how/if that should translate into docs somehow or if I should just ignore macros that are returned by cljs.analyzer.api/ns-publics

martinklepsch12:07:56

because as far as I understand macros in cljs are usually just clj macros right (ignoring self-hosting here)

dnolen12:07:30

yes but is the behavior of c.a.a/ns-publics different from Clojure ns-publics?

dnolen12:07:37

if so, that’s a bug, and should be filed / tracked

martinklepsch13:07:45

I think that might be the case

martinklepsch13:07:08

it seems that when the macro arglist includes something like & body the arglist returned by ns-publics includes &form &env

dnolen13:07:42

k I would put all that into a ticket - probably something simple

martinklepsch13:07:09

@dnolen https://dev.clojure.org/jira/browse/CLJS-2852 — Let me know if this needs more info

martinklepsch13:07:33

(doto (defmacro with-config-override [opts & body]
        `(with-config-override* ~opts (fn [] [email protected])))
  (alter-meta! assoc :arglists '([{:keys [switches secret-keys override-switches] :as opts-override} & body])))
this also results in different arglists — clj has the updated one — is that expected?

dnolen13:07:48

or - actually … not necessarily

dnolen13:07:09

make another ticket - could probably make that work too?

martinklepsch13:07:02

So just for my immediate need: - given I have the clj and cljs publics for a namespace available - is there any reason for me to care about the macros as returned by cljs-publics? - as far as I understand macros clj/cljs ns-publics macros should always be equal? i.e. (= (filter macro? clj-ns-publics) (filter macro? cljs-ns-publics))

dnolen15:07:33

should yeah

martinklepsch15:07:01

Ok so I’ll just ignore macros returned from cljs ns-publics for now and instead use the info returned from clojure’s ns-publics