Fork me on GitHub

Me, trying to be smart and sneak in read-eval to deps.edn: 1. creates data_readers.clj with {clj/eval clojure.core/eval} 2. creates alias with :key #clj/eval (requiring-resolve my-fn) in :exec-args clj_exec.clj: uses edn/read-string that ignores data_readers




I think clj-exec is limiting by only accepting edn data. I want to pass a function, I don't want to add work-arounds that accept and auto-resolve symbols where exec function they expect functions as arguments


@vlaaad Whilst I share some of that frustration (after hours poking at the internals of Figwheel, Rebel Readline, and the cljs compiler itself), I think it would pretty dangerous -- I think it is reasonable for the function you invoke to have to do the requiring-resolve because it's generally easy enough to write a wrapper that you can invoke (and have it invoke whatever you're trying to pass a function into).


I agree that read-eval is probably too dangerous for a problem I don't have a solution for, but passing function to a function should not be impossible with clj-exec IMO


What’s wrong with passing the fully qualified name? Don’t prepls repls and socket servers behave this way?


clojure.main/repl expects functions, for example, so it can't be used from clj-exec


Yeah, that was similar to my use case: where I want a resolved symbol, which has to happen at runtime, hence a wrapper is needed.

Alex Miller (Clojure team)21:01:26

We are working towards a solution to this greater problem

🙏 3
Alex Miller (Clojure team)21:01:05

In particular, making vars autoresolve on read

Alex Miller (Clojure team)21:01:50

Note, not symbols but vars

Alex Miller (Clojure team)21:01:24

A release or two ago we changed var deserialization to do that

Alex Miller (Clojure team)21:01:58

I took a pass at var resolution at that point as well but we decided to wait on it. That’s likely to be in scope for 1.11


Upvoted! Thanks for detailed response

Alex Miller (Clojure team)21:01:25

You’re not crazy :). We’ve been thinking about this for years