This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-06-19
Channels
- # babashka (2)
- # babashka-sci-dev (15)
- # beginners (44)
- # clara (6)
- # clj-kondo (5)
- # clojure (39)
- # clojure-europe (5)
- # clojurescript (14)
- # data-science (5)
- # datahike (6)
- # datalevin (7)
- # graalvm (2)
- # helix (3)
- # humbleui (8)
- # minecraft (1)
- # missionary (10)
- # nbb (8)
- # nrepl (2)
- # portal (11)
- # shadow-cljs (3)
- # tools-deps (6)
- # xtdb (10)
@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.
It looks at git tags output
If you can post a jira or ask Clojure that would be most helpful
https://ask.clojure.org/index.php/11983/why-does-tools-install-latest-not-always-find-latest-version
Thanks for tracking this. Is there any way in which I can take this up to fix it?
I'm working on it, thx
new prerelease of Clojure CLI is now available - version 1.11.1.1145 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
did some cleanup on the output too
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!
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?
Some relevant javadoc https://grpc.github.io/grpc-java/javadoc/io/grpc/ServiceDescriptor.html
I am trying to understand how best to use the "Improving Startup time" article at https://clojure.org/guides/dev_startup_time
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 practicalli.app.service
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 'practicalli.app.service)
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)
If you load user.clj with compile-files as true, anything user loads will get aot compiled
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 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)
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])
(:gen-class))
(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?what is #=
? dont see it in https://clojure.org/reference/reader
(ns my.main
(:require [clojure.edn :as edn])
(:gen-class))
(defmacro read-foo []
`(def foo '~(edn/read-string (slurp "foo.edn")))
(read-foo)
(defn -main [& args]
(println foo))
This seems to do what i want :thumbsup: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))
#=(...)
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: https://clojuredocs.org/clojure.java.io/resource
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 {,,,}}
(ns my.main
(:require [clojure.edn :as edn])
(:gen-class))
(defmacro read-foo []
`(def foo '~(edn/read-string (slurp "foo.edn")))
(read-foo)
(defn -main [& args]
(println foo))
This seems to do what i want :thumbsup: