This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
A long time ago I used lein to create my project which I've been developing for several months. It created the files in the project which I just used as a template but didn't understand on day 1. How when I look at the main ns declaration, I wonder whether the form
(:gen-class) needs to be removed. What purpose does it serve?
(ns clojure-rte.core (:require [clojure.set :refer [union]] [clojure.pprint :refer [cl-format]] [clojure-rte.cl-compat :refer [cl-cond]] [clojure-rte.util :refer [with-first-match call-with-collector fixed-point visit-permutations rte-constantly rte-identity partition-by-pred print-vals sort-operands member]] [clojure-rte.type :as ty] [clojure-rte.dfa :as dfa ] [clojure-rte.rte] [clojure-rte.memoize] [clojure-rte.api] [clojure-rte.type-extend] ) (:gen-class))
if you don't aot compile, perhaps it is not necessary. this page might have some useful details: https://clojure.org/reference/compilation
:gen-class simply allow me to define a function named
-main which is then automatically called whenever the class is loaded?
No, it compiles a class with a static method named main (the - is the default prefix)
Or you can just use clojure.main for the same purpose - it knows how to call the -main method on a Clojure ns (compiled or not)
what does a "Java main entry point" do? is that the function which is automatically run when java is started from the unix command line?
Yes - you start Java with a class name and it loads that class and invokes it’s static main method
And I also see that in cursive, there is a green play triangle if there is a
-main method and
:gen-class has been specified.
In fact, that will be there even if
gen-class is not specified. From my understanding of this project, I think you can remove the
G'morning. Is there any way to add middleware to the nrepl that cursive sets up, when you choose the nrepl option for your repl configuration?
Found an answer. Create .nrepl.edn in the root of your project with middleware specified like this: