2017-09-07 7:09 GMT+02:00 Didier <[email protected]>:

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

​Thanks. That makes sense.

-- 
Cecil Westerhof

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to