events

Announcements about events, meetups, conference. Respond in threads please.
Chase 2021-01-14T18:46:16.004200Z

@seancorfield Is this where we can ask more questions about the video? I've been trying to explore reveal more too so want to follow along with you.

Chase 2021-01-14T18:47:22.004400Z

I'm looking at your dot-clojure repo. So I think what's happening is that in you called the :reveal and :dev aliases at the command line.

Chase 2021-01-14T18:48:05.004600Z

The :dev alias actually calls out to this dev.clj file which is where all those other reveal options are coming in from. Is that correct?

Chase 2021-01-14T18:48:31.004800Z

So to recreate I would create that dev.clj file and throw it next to my deps.edn file?

seancorfield 2021-01-14T18:48:41.005Z

Probably easier to follow-up either in #tools-deps or via DM but I guess some of this deserves a broader audience...

seancorfield 2021-01-14T18:49:54.005200Z

The dot-clojure repo has a whole bunch of (opinionated) tooling that works together. The dev.clj file lives in that repo -- i.e., it goes into your .clojure folder with the (user) deps.edn which is assumed to contain all the various aliases I regularly use.

seancorfield 2021-01-14T18:51:51.005400Z

:dev (and now, preferred, :dev/repl) is an alias that uses :main-opts to load the dev.clj script. :reveal pulls in Reveal and would run it as well, if it were the last alias on the command-line that contained :main-opts.

seancorfield 2021-01-14T18:53:52.005600Z

To explain that: when you use multiple aliases, their bodies are combined. Mostly they are merged: either a merge of hash maps or a conj of vector contents (`:jvm-opts`) but with :main-opts it is "last one wins" so only one alias's :main-opts end up being used.

seancorfield 2021-01-14T18:55:18.005800Z

clj -M:reveal would start Reveal as the main REPL. clojure -M:rebel would start Rebel Readline as the main REPL. clj -M:reveal:rebel will start Rebel Readline but also make Reveal available as a dependency -- because the :main-opts for :rebel "wins" by being the last alias.

seancorfield 2021-01-14T18:57:09.006Z

clojure -M:reveal:rebel:dev/repl uses the :main-opts from :dev/repl as the last alias to have any main opts, so Reveal and Rebel Readline are on the classpath but their -main functions are not called. The code in dev.clj runs, looks at what is available via the classpath, and decides which REPL to start up and how to combine the various utilities.

seancorfield 2021-01-14T18:57:16.006200Z

Does that help @chase-lambert?

Chase 2021-01-14T19:04:38.006400Z

Mostly! Still wrapping my head around the last alias wins. Is it only in the case of a conflict that it wins because otherwise why use more than one alias.

Chase 2021-01-14T19:05:55.006600Z

Oh wait, so only the :main-opts part pertains to this last one wins.

seancorfield 2021-01-14T19:06:07.006800Z

See https://clojure.org/reference/deps_and_cli#_execution

seancorfield 2021-01-14T19:09:52.007Z

(one important thing to note is that my :dev & :dev/repl aliases will not work on an XDG system because they assume $HOME/.clojure -- on an XDG system that's most likely to be $HOME/config/clojure as I recall)

Chase 2021-01-14T19:10:51.007300Z

Yep, $HOME/.config/clojure

Chase 2021-01-14T19:11:29.007500Z

So your :add-libs alias has a :main-opts section and you still use that even though it's not the last alias you call

seancorfield 2021-01-14T19:13:55.007700Z

Several aliases have :main-opts but those options are not used if a later :main-opts is present. The aliases still bring in the specified dependencies.

Chase 2021-01-14T19:14:29.007900Z

ahh, ok, so you are using everything in the :add-libs alias except for the :main-opts

seancorfield 2021-01-14T19:14:58.008100Z

With :add-libs it's just a bit of "magic" to ensure a DCL (DynamicClassLoader) context for any REPL that is started -- but my dev.clj also contains that code.

Chase 2021-01-14T19:15:50.008300Z

Yeah, I'm trying to parse your dev.clj to see if I can yank it wholesale or if it's going to conflict because I'm using cider nrepl vs your socket approach. hahaha

Chase 2021-01-14T19:17:43.008500Z

So basically whatever alias that will have the call to this dev.clj file has to come last right. My apologies if I'm being super dense about this.

seancorfield 2021-01-14T19:17:49.008700Z

The issue I'm working around with that DCL stuff is that a Socket REPL does not use a DCL context (and neither did Cognitect's REBL). Now that I have dev.clj, any Socket REPL started by it will have a DCL. But I left it in :add-libs (and :rebl) so that I can start a more barebones REPL and still have the DCL context that add-libs (the function) needs.

seancorfield 2021-01-14T19:18:16.008900Z

Yes, clojure -M:lots:of:aliases:and:then:load-dev.clj

Chase 2021-01-14T19:23:01.009500Z

Cool, I will try to pilfer what I can. I use your's and practicalli's. That install-reveal-extras function is a bit intimidating but I think I want it. Haha.

Chase 2021-01-14T19:23:38.009700Z

I kind of wish it was just an option to throw in to the reveal main opts. "corfield-reveal-extras" or whatever

Chase 2021-01-14T19:31:20.009900Z

And so you aren't getting any of the :main-opts from :test either? Hahaha, this seems to be tripping me up. I'm assuming the main opts just aren't that important.

seancorfield 2021-01-14T19:37:58.010100Z

:runner is the alias I use to run tests. :test just brings in some useful stuff.

seancorfield 2021-01-14T19:38:39.010300Z

;; testing and debugging tools (this would normally be overridden
  ;; by a :test alias in the project deps.edn file -- but it's a
  ;; useful default):
  :test {:extra-paths ["test" "src/test/clojure"]
         :extra-deps {org.clojure/test.check {:mvn/version "RELEASE"}}}
:test has no :main-opts

Chase 2021-01-14T19:58:17.010500Z

got it! Awesome. The more I use these tools the more I like them but it definitely takes some tweaking

seancorfield 2021-01-14T19:58:43.010700Z

It's like a set of LEGO bricks!

Chase 2021-01-14T19:59:00.010900Z

Well put.