Fork me on GitHub
#cljs-dev
<
2021-11-30
>
dnolen00:11:12

Closure compiler mailing list

borkdude11:11:25

I noticed that tools.namespace doesn't work for a few CLJS cases: 1. it does not understand string requires (which are typically used for NPM deps), it throws on them 2. it does not take into account :require-macros I'm maintaining a fork of tools.namespace that is compatible with babashka and fixed it in the fork. I am using this fork to detect which macro namespaces are used from a set of .cljs files, to calculate a hash and download the advanced build from elsewhere if it's already available in cloud storage. https://github.com/babashka/tools.namespace/commit/8f44ac78798eaf7078cc9ad93fbe1f45bbe9c3c4#diff-cb6f40623e14bf72e25ddaf89bc83c20a3aafa5076ad2c8cadf98a4d609f0b70 https://github.com/babashka/tools.namespace/commit/a13b037215e21a2e71aa34b27e1dd52c801a2a7b#diff-cb6f40623e14bf72e25ddaf89bc83c20a3aafa5076ad2c8cadf98a4d609f0b70 Is there any interest in receiving those fixes back (if they are considered appropriate)?

Alex Miller (Clojure team)13:11:41

Sure! I can help with that if you want to provide patches

borkdude14:11:50

@alexmiller sure. do I need to make a JIRA issue for both?

Alex Miller (Clojure team)14:11:22

a jira would be helpful just so we have something for tracking. if they are both in the bucket of "cljs compatibility", I think it could just be one jira

borkdude14:11:44

I'll describe the issues here, so perhaps @dnolen can verify if my changes make sense. Issue 1.

(ns foo (:require ["some-npm-dep"] [normal.cljs.dep]))
ns deps for this ns decl should return #{'normal.cljs.dep} and not throw on the string, which it does now. Arguably it should also return some-npm-dep but you can't statically know if this is a normal cljs dep or an NPM dep. But as the return value is expected to be symbols, I think it's safest to just ignore it.

borkdude14:11:30

Issue 2.

(ns foo (:require-macros [clj.dep :refer [x y z]]))
Should return a dependency on clj.dep but right now ignores :require-macros. I added :require-macros to the list of :use,`:require` to detect dependencies.

Alex Miller (Clojure team)14:11:06

I feel like maybe one or both of these are existing jiras

dnolen15:11:47

@borkdude yep that sounds right

borkdude15:11:32

@alexmiller I'll try to provide a patch for TNS-51 later this week. For the other issue I'll make a new JIRA + patch.

Alex Miller (Clojure team)16:11:48

@quoll @dnolen fyi re cljs math stuff https://clojure.atlassian.net/browse/CLJ-2673 (removes min + max, moves abs to core), also https://clojure.atlassian.net/browse/CLJ-2672 for the docstring fix

👍 1
Alex Miller (Clojure team)16:11:08

if you have a confidence level that cljs can support all (or nearly all) the math functions, that would be useful to know. doesn't have to be done, just looking for whether you believe it can be

quoll17:11:27

Yes, I’m confident. I have implementations for almost everything now (not all tested). The most complex ones are tractable

quoll17:11:28

They rely on bit operations which I’ve been able to completely duplicate in ClojureScript

borkdude16:11:56

I'm happy to see the collaboration on this!

💯 2