clojure

New to Clojure? Try the #beginners channel. Official docs: https://clojure.org/ Searchable message archives: https://clojurians-log.clojureverse.org/
borkdude 2020-10-20T08:36:14.354400Z

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?

borkdude 2020-10-20T08:44:24.354700Z

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

borkdude 2020-10-20T08:45:23.355100Z

@bronsa knows maybe?

2020-10-20T08:50:40.355700Z

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

borkdude 2020-10-20T08:51:23.356200Z

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

borkdude 2020-10-20T08:53:07.357100Z

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

2020-10-20T08:53:15.357400Z

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)

2020-10-20T08:53:41.357900Z

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

borkdude 2020-10-20T08:53:50.358100Z

kcool

bronsa 2020-10-20T08:57:33.358300Z

yep

valerauko 2020-10-20T14:01:00.361900Z

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?

alexmiller 2020-10-20T14:02:16.362400Z

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

2020-10-20T14:02:22.362600Z

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

valerauko 2020-10-20T14:03:55.362900Z

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

2020-10-20T14:07:57.363300Z

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.

valerauko 2020-10-20T14:15:36.364Z

lemme try that

valerauko 2020-10-20T14:31:31.364600Z

haha this is embarrassing

valerauko 2020-10-20T14:32:31.365100Z

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

valerauko 2020-10-20T14:32:55.365300Z

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

2020-10-20T16:06:23.365500Z

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

2020-10-20T16:07:08.365700Z

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.

quadron 2020-10-20T17:49:16.366900Z

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

seancorfield 2020-10-20T17:49:37.367300Z

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

quadron 2020-10-20T17:50:14.367600Z

@seancorfield i'm using your depstar

seancorfield 2020-10-20T17:50:41.368100Z

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

seancorfield 2020-10-20T17:51:26.369500Z

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

quadron 2020-10-20T17:51:33.369700Z

thx, i suspected it parses something in the deps file

seancorfield 2020-10-20T17:51:44.370Z

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