If I would have a macro like this:
user=> (require '[babashka.process :as bp :refer [$ check]] :reload)
nil
user=> (def sw (java.io.StringWriter.))
#'user/sw
user=> (-> ($ ls) ^{:out sw} ($ cat) check (do nil))
nil
user=> (str sw)
"LICENSE\nREADME.md\ndeps.edn\nsrc\ntest\n"
which can receive options via metadata, would this cause any problems with garbage collection of the options map in general?I mean, forms are discarded after being read and evaluated normally right?
@bronsa knows maybe?
I don’t get the question I think. What is your concern in this case?
if the stringwriter isn't being referenced somewhere unexpected so it won't ever be cleaned up
in this example it's in a var, but I mean in general, let's say if it was a local
Yeah I would think that if you didn’t have the (def sw ..)
it would be cleaned up after the 3rd statement (given *1
and *2
)
Ah yeah as far as I know it would be cleaned up 🙂
kcool
yep
I just spent time tracking down some reflections that I wasn't warned about. They were happening inside a proxy
and I only noticed because the Reflector calls were taking up a huge chunk of my profiled flame charts. Is this normal?
more info needed, would prefer a report with repro at https://ask.clojure.org
Did the file of code in which these reflections were occurring have (set! **warn-on-reflection** true)
near the top?
no i'm setting warn-on-reflection in my project.clj
In a Leiningen project, as far as I know that should be effectively the same as putting that set!
in all of the source files, but it would help the investigation of the issue to put such a set!
in the file that had the reflection uses, and confirm that it still gives no reflection warnings when compiling, to be sure.
lemme try that
haha this is embarrassing
because warn-on-reflection was set in project.clj i was also getting a ton of reflection warnings from libraries (nrepl) that simply drowned out the 3 warnings from my own code
setting it in the source file only let me see just my own warnings
No worries. Cool that the Clojure compiler can already catch them.
There is an advantage to figuring out a way to make sure that errors you want to ignore, are not seen, keeping warnings you want to see short.
when i install a deps project, where do i specify the version?!
@veix.q5 What do you mean by "install a deps project"?
@seancorfield i'm using your depstar
Ah, so you need a pom.xml
file. That's where the group ID, artifact ID, and version would normally be specified.
clojure -Spom
will generate a skeleton pom.xml
for your project, based on your dependencies. And it will guess the group/artifact based on the project folder name, and pick an arbitrary initial version (`0.1.0-SNAPSHOT` I think?)
thx, i suspected it parses something in the deps file
So then you edit pom.xml
to have the values you want, then run depstar
.