cursive

Issues at: https://git.io/cursive-issues
cfleming 2020-09-19T02:57:46.009200Z

Can you show me an example of what you want?

Jim Newton 2020-09-19T09:04:38.011200Z

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

2020-09-19T09:51:34.011700Z

if you don't aot compile, perhaps it is not necessary. this page might have some useful details: https://clojure.org/reference/compilation

Jim Newton 2020-09-19T11:07:55.012700Z

does :gen-class simply allow me to define a function named -main which is then automatically called whenever the class is loaded?

alexmiller 2020-09-19T11:44:04.013900Z

No, it compiles a class with a static method named main (the - is the default prefix)

alexmiller 2020-09-19T11:44:29.014300Z

There is no automatic anything

alexmiller 2020-09-19T11:45:30.015400Z

When Java runs, it needs a class with a staric main to invoke

alexmiller 2020-09-19T11:45:59.016200Z

So :gen-class + a compile can give you a Java main entry point

alexmiller 2020-09-19T11:47:12.017900Z

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)

Jim Newton 2020-09-19T14:03:42.018600Z

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?

Michael W 2020-09-19T14:30:41.020400Z

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?

alexmiller 2020-09-19T14:36:13.021700Z

Yes - you start Java with a class name and it loads that class and invokes it’s static main method

1πŸ‘
Jim Newton 2020-09-19T14:39:34.021900Z

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.

Jim Newton 2020-09-19T14:40:23.022400Z

That's pretty useful actually πŸ™‚