Fork me on GitHub

@alexmiller - how does install-latest work on clojure tools? I ended up with v0.4.9 of deps-new . The latest version is 0.4.12 .


I re-posted this in #tools-deps so it doesn't get lost here. I can confirm that I see the same behavior and I'm pretty puzzled by that since that was released back in January and there have been three releases since then.


Very likely there's a max-key that's comparing on string.


Does it look up tags? I am not sure.

Alex Miller (Clojure team)13:06:56

It looks at git tags output

Alex Miller (Clojure team)13:06:41

If you can post a jira or ask Clojure that would be most helpful


Thanks for tracking this. Is there any way in which I can take this up to fix it?

Alex Miller (Clojure team)07:06:49

new prerelease of Clojure CLI is now available - version if anyone wants to try it, also adds a no-arg variant to -X:deps install-latest to install the latest of all installed tools

Alex Miller (Clojure team)07:06:02

did some cleanup on the output too

Alex Miller (Clojure team)07:06:25

or actually, you can test it even more easily by just installing the latest version of the tools tool (not really any changes to the CLI itself):

clj -Ttools install-latest :tool tools


I found another non-working case (and added a comment on the ask post)


Thanks for fixing that too!

Ben Sless13:06:42

Coming back to a question I brought up in the past, I want to use java reflection to emit wrappers for all grpc methods of some service I want to emit direct method handles and to not have to allocate arrays on call In grpc these methods are called on the emitted stubs from service description. Do I need to use the method handles lookup on the specific emitted stubs or are their classes enough? What's the correct code path to get there?


I am trying to understand how best to use the "Improving Startup time" article at I understand the part about (re)loading the user namespace, as the binding expression temporarily sets *compile-files* to true and then requires the user namespace, compiling the user namespace and any libraries or code that the user namespace includes via its ns form I am not so clear on the strategy to compile the rest of the project. Assuming the is the main entry point into the project, requiring libraries and namespaces that account for all of the project. I would only need to add (compile ' expression to my user namespace and pretty much everything in the project would be compiled. Is that correct? I assume I only need to explicitly complie a namespace that not required by another namespace I am calling with compile (or one of its requires)


I would not call compile explicitly like that


If you load user.clj with compile-files as true, anything user loads will get aot compiled


So replace the call to compile with a call to require


But in general the whole setup looks like a recipe for problems where things are double compiled


If you have to do it, it seems like it would be best to have that force reload line above the ns form, as high up as possible before any code is loaded so it only loads once


I don't think the article is very good


I suspect putting a force reload require of the current namespace, as a top level effect of loading the namespace would just loop


If compile-files is true (which the binding sets) ever but of code loaded is aot compiled


So if you assume the force reload of user doesn't loop, the second load of user, with reload all, would reload app.service whatever, and aot compile it


I suspect the intent with that snippet of code (with the binding) is to drop it in a repl, not in a file (where it would infinitely loop reloading itself)


compile and require both load and run the given code


So not being willing to require code when you are willing to call compile doesn't make much sense


when exactly is “compile-time”? I thought I could do this

(ns my.main
  (:require [clojure.edn :as edn])

(defmacro read-foo []
  (quote (edn/read-string (slurp "foo.edn"))))

(def foo (read-foo))

(defn -main [& args]
  (println foo))
build an uberjar from it and that namespace would include the data read from foo.edn. What actually happens is I get a FileNotFoundException on foo.edn Is what I`m trying to do possible or would I have to read and include it as part of the build?

Jan K23:06:56

Try (def foo #=(edn/read-string (slurp "foo.edn"))


(ns my.main
  (:require [clojure.edn :as edn])

(defmacro read-foo []
  `(def foo '~(edn/read-string (slurp "foo.edn")))


(defn -main [& args]
  (println foo))
This seems to do what i want :thumbsup:

Jan K00:06:32

#=(...) evaluates the form at read-time but I guess it's not documented


indeed. I see my issue is doing some stupid stuff with integrant. the file with the macro isn’t actually being compiled. thanks jan!


An alternative is:

(defmacro read-foo []
  (list 'quote (edn/read-string (slurp "foo.edn"))))

(def foo (read-foo))

👍 1

#=(...) is very discouraged. Fortunately, you don't need it here.


if you want to defer the reading of that file, an option is using resources on the classpath. See example here: Note - if you're using deps.edn , resources will not automatically be on the classpath, and you'll need something like this in your deps.edn:

{:paths ["src" "resources"]
 :deps {,,,}}

👍 1

Resources is the way to go