Clojure is always launched from Java, there's no way to bootstrap straight into Clojure from the JVM. So when you launch the JVM, it always starts in a Java main method. What Clojure does normally, is that it creates the Java main method for you, and have it call your own main method.
So it goes: JVM -> Java main method -> Clojure main function. What creates the Java main method for you is the (gen-class) macro. To know which of your Clojure function to have the Java main method it'll generate call, it uses a convention. This convention by default is that it will call the function named "-main". You can choose to change the "-" to any other prefix, but it is "-" by default. The convention forces you to have it end with "name", but lets you choose whatever prefix you want, which is "-" by default. I think you could set the prefix to "" and have your Clojure main function be called simply "main" if you want (never tried it though). Why is it prefixed? Well, the idea of having a prefix is that any Clojure function used for interop, in the sense that it is designed to be called from Java, is prefixed, so you can easily know its purpose is Java interop. So by default, all Clojure function prefixed with "-" can be assumed to be interop functions used by Java. On Wednesday, 6 September 2017 14:56:35 UTC-7, Cecil Westerhof wrote: > > 2017-09-06 23:42 GMT+02:00 Justin Smith <noise...@gmail.com <javascript:>> > : > >> To define a method in gen-class you need to use a prefix on the function >> name, "-" is the default prefix >> > I have to delve a little deeper into that on a rainy day. > > > > >> On Wed, Sep 6, 2017, 14:41 Cecil Westerhof <cldwes...@gmail.com >> <javascript:>> wrote: >> >>> 2017-09-06 23:27 GMT+02:00 Matching Socks <phill...@gmail.com >>> <javascript:>>: >>> >>>> There is a hint, as to this, in the API doc of gen-class: >>>> >>>> >>>> https://clojure.github.io/clojure/clojure.core-api.html#clojure.core/gen-class >>>> >>> >>> That explains what happens, not why. ;-) >>> >> > -- > Cecil Westerhof > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.