clojurescript

ClojureScript, a dialect of Clojure that compiles to JavaScript http://clojurescript.org | Currently at 1.10.879
g7s 2021-01-12T19:10:40.284100Z

As I understand a var's metadata is statically determined at compile-time so I was thinking that if I passed to a var's metadata another var that would be OK but this is not the case apparently. For example if I do

(defn foo [a] a)
(defn bar {:foo #'foo} [a] a)
then the (:foo (meta #'bar)) will not be the #'foo var but instead the unevaluated form (var foo). It seems that I cannot do this even at runtime because a var's metadata cannot be altered. Is there any other way I could do this?

dnolen 2021-01-12T19:26:44.284900Z

there is no way around var metadata being statically determined, if you're trying to figure out a way around that - it isn't possible

g7s 2021-01-12T19:34:14.287800Z

I wasn't trying actually to figure out a way around it but instead to figure out a way to point from one var to another, but I guess there is no easy way to do this in cljs

g7s 2021-01-12T19:35:45.288500Z

I was trying to make https://github.com/clojure/tools.analyzer/blob/master/src/main/clojure/clojure/tools/analyzer/passes.clj work in a cljs setting

g7s 2021-01-12T19:36:23.289100Z

It creates dependencies between vars via their metadata

dnolen 2021-01-12T20:47:51.290300Z

@g7s why do you need to do that with var metadata?

dnolen 2021-01-12T20:48:06.290700Z

you could just do with a compiler pass same as Clojure

g7s 2021-01-12T21:12:19.290800Z

Hmm I am not sure what you mean. To give you some context I am building something that involves a compiler and I was copying the code (with some changes) to use it in my project that should work in both cljs and clj. I don't know how familiar you are with this code but it works by analysing the var metadata of every pass and then it tries to perform as few passes as possible (by combining passes that can be coombined)