Clojure Development: IDE or REPL?

后端 未结 7 1249
野趣味
野趣味 2021-02-02 13:05

I\'ve been using Clojure for a little while and want to create some projects that are bigger and more complicated than toys. I\'ve been using Java for the past few years and hav

7条回答
  •  灰色年华
    2021-02-02 13:47

    Well, to start off, virtually any decent development plugin for any editor or IDE will give you a way to use the Clojure REPL from within the IDE. Probably even allow you to load files into the REPL for testing and such. You don't need to choose one or the other.

    Enclojure is going a long way, that is for sure. However, most people are perfectly happy with using Emacs, including myself. Emacs uses a Lisp as its configuration language, so it's usually the most natural choice to a Lisper.

    For languages that have REPLs, using the REPL as a major part of the development process is the norm. Editing files, loading them into the REPL, playing with them to see if a work, rinse, repeat. This is one of the major advantages of languages with REPLs like Clojure and Haskell and CL and such.

    As for building jars, and compiling Clojure code and stuff, that's simple. You don't even really /have/ to Compile Clojure code most of the time if you don't want to. When you do, you AOT compile it with gen-class, which compiles it to class files that you can then put into a jar. There are tons of examples and even tutorials spread amongst the interwebs. The easiest and most efficient way is to use something like Ant and writing a build script that compiles Clojure code and generates the .jar for you. The first time I did it, I thought it was going to be hard to do, but it was actually really simple. I just looked at the Clojure and Clojure-Contrib Ant build files, and referenced the Ant help pages for everything else I needed.

    One thing I should mention is the fact that Enclojure /does/ actually build executable .jar files for you, if you request it to do so. I'm sure more advanced things you're used to will be added in the future. They are, indeed, still quite new.

提交回复
热议问题