Reputation: 14479
The examples I've seen of main methods defined in clojure all use gen-class, together with (defn -main ...). Is it possible to define a class with an executable main method using deftype?
Upvotes: 3
Views: 419
Reputation: 106401
A main method only makes sense if you AOT compile it (with gen-class or similar).
If you tried to define it in any other way, then it wouldn't be possible to use it since you would need to launch the clojure compiler / environment first. So you'd have to start the app by calling some other main() method instead.....
Upvotes: -1
Reputation: 2489
it is not possible, because interfaces (protocols) that deftype can implement cannot have static methods.
Upvotes: 8