Fork me on GitHub
Jesús Gómez13:02:59

Hello. What is the current way to require the function add-lib or add-libs these days?


This is how I hotload for libraries, using a rich comment block. It could also be done in the deps.edn file but I prefer the rich comment

👍 1
Jesús Gómez14:02:24

Thank you very much. Kind of an aside, but I notice that the page of tools.deps.alpha say it is obsolete and tools.deps should be used[1], but I didn't find add-libs in tools.deps (maybe I didn't search enough). Do you know if the function add-libs is part of tools.deps namespace somewhere, maybe a sub namespace I'm not finding? [1]


As I understand it, tools.deps should be used for everything, except add-libs which has not yet been finalised (although it hasnt changed much in the last year). So just for add-libs, use tools.deps.alpha until Alex is kind enough to find time to finalise the add-libs feature and include it in tools.deps or there preferred way to package it.

👍 1
Jesús Gómez14:02:58

Now I understand. Thank you very much!


Thanks, I just noticed that too... the book is being refactored and I'm working on improviing that bit today and expanding on hotloading and other tools for a REPL reloaded page... the left hand navigation should all work though...

👍 1

Based on recent comments here from Alex, add-libs should probably be out of alpha pretty soon, I think.

Alex Miller (Clojure team)16:02:32

indeed, there will be an official way to do this soon (but it will not be in tools.deps at all)

❤️ 3
Jesús Gómez15:02:37

What happens when I include many aliases and each one has main-opts? Which of those libraries' main methods will be called and with what main-opts?

clj -M:alias-1:alias-2:...:alias-n


In a chain of aliases, only the last :main-opts definition is used, so in the example only :main-opts from :alias-n

Jesús Gómez15:02:21

Thank you!

👍 1
Jesús Gómez15:02:04

I found the doc reference of this information: (Regarding :main-opts) "If multiple maps with these keys are activated, only the last one will be used"