Fork me on GitHub
#clojure
<
2020-10-20
>
borkdude08:10:14

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?

borkdude08:10:24

I mean, forms are discarded after being read and evaluated normally right?

jeroenvandijk08:10:40

I don’t get the question I think. What is your concern in this case?

borkdude08:10:23

if the stringwriter isn't being referenced somewhere unexpected so it won't ever be cleaned up

borkdude08:10:07

in this example it's in a var, but I mean in general, let's say if it was a local

jeroenvandijk08:10:15

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)

jeroenvandijk08:10:41

Ah yeah as far as I know it would be cleaned up 🙂

valerauko14:10:00

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?

andy.fingerhut14:10:22

Did the file of code in which these reflections were occurring have (set! **warn-on-reflection** true) near the top?

valerauko14:10:55

no i'm setting warn-on-reflection in my project.clj

andy.fingerhut14:10:57

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.

valerauko14:10:36

lemme try that

valerauko14:10:31

haha this is embarrassing

valerauko14:10:39

tldr the warnings were there alright

valerauko14:10:31

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

valerauko14:10:55

setting it in the source file only let me see just my own warnings

andy.fingerhut16:10:23

No worries. Cool that the Clojure compiler can already catch them.

andy.fingerhut16:10:08

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.

Alex Miller (Clojure team)14:10:16

more info needed, would prefer a report with repro at https://ask.clojure.org

quadron17:10:16

when i install a deps project, where do i specify the version?!

seancorfield17:10:37

@veix.q5 What do you mean by "install a deps project"?

quadron17:10:14

@seancorfield i'm using your depstar

seancorfield17:10:41

Ah, so you need a pom.xml file. That's where the group ID, artifact ID, and version would normally be specified.

seancorfield17:10:26

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?)

quadron17:10:33

thx, i suspected it parses something in the deps file

seancorfield17:10:44

So then you edit pom.xml to have the values you want, then run depstar.