tools-deps

Discuss tools.deps.alpha, tools.build, and the clj/clojure command-line scripts! See also #depstar #clj-new
vlaaad 2021-01-03T20:48:34.183700Z

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 https://github.com/clojure/brew-install/blob/fde9db19bfe92a315b81b5f56d290a6d37a91d89/src/main/resources/clj_exec.clj#L39

vlaaad 2021-01-03T20:48:37.183900Z

¯\(ツ)

vlaaad 2021-01-03T20:50:16.185700Z

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

seancorfield 2021-01-03T20:56:02.187800Z

@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).

vlaaad 2021-01-03T20:59:11.189200Z

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

dpsutton 2021-01-03T21:04:47.190100Z

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

vlaaad 2021-01-03T21:05:39.190700Z

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

seancorfield 2021-01-03T21:07:58.192400Z

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.

alexmiller 2021-01-03T21:12:26.193Z

We are working towards a solution to this greater problem

🙏 1
alexmiller 2021-01-03T21:13:05.193700Z

In particular, making vars autoresolve on read

alexmiller 2021-01-03T21:13:50.194300Z

Note, not symbols but vars

alexmiller 2021-01-03T21:14:24.195100Z

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

alexmiller 2021-01-03T21:15:58.197100Z

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

alexmiller 2021-01-03T21:19:41.197800Z

Votes welcome :)

vlaaad 2021-01-03T21:20:27.198100Z

Upvoted! Thanks for detailed response

alexmiller 2021-01-03T21:22:25.198800Z

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