News for hackers. Stuff that matters.
Re:Why I'm Productive in Clojure by andrewvc on Wednesday July 23, 2014 @10:12AM (#8074443)
Well, people do use these tools, but honestly, do you really want a language with multiple build tools / package managers? The java world is a mess here. Leiningen is pretty great, no need to fragment the community.

As far as editors go, I'm perplexed. You can use nearly any editor, why do you perceive the need to use one of these 2?

Re:Why I'm Productive in Clojure by ehurrell on Wednesday July 23, 2014 @11:56AM (#8075018)
Completely agree with leiningen, it's not an opinionated choice, just what I've seen with maven seems a huge hassle.

In terms of editors I've hit this a bit, attempting to follow tutorials or the like is frequently met with 'step n: install the clojure plugin for Emacs', then 'eval with <Emacs keybinding>' forever after. The Om tutorials iirc are written as tutorials through Light Table (which seems like a great editor). Having to separate learning about the language and how the editor does things just increases the barrier to entry.

Re:Why I'm Productive in Clojure by Dewie on Wednesday July 23, 2014 @12:02PM (#8075057)
> The Om tutorials iirc are written as tutorials through Light Table

What is Om? I can't seem to google it.

Re:Why I'm Productive in Clojure by buerkle on Wednesday July 23, 2014 @12:15PM (#8075136)
It's a clojurescript library built on top of Facebook's React javascript library. https://github.com/swannodette/om
Re:Why I'm Productive in Clojure by ics on Wednesday July 23, 2014 @12:11PM (#8075121)
Searched 'clojure om' and came up with this: https://github.com/swannodette/om/wiki
Re:Why I'm Productive in Clojure by edwinnathaniel on Wednesday July 23, 2014 @01:26PM (#8075618)
Let's not exaggerate things here ;). Java world is fine. Majority of projects are still using Maven.
Re:Why I'm Productive in Clojure by Touche on Wednesday July 23, 2014 @10:38AM (#8074582)
> Well, people do use these tools, but honestly, do you really want a language with multiple build tools / package managers?

I want multiple workflows. A single build tool can accommodate that, but Leiningen can't/doesn't.

For example, let's say I have a compiler called mycc. I can build something like this:

    mycc main.c -o main
I might then combine it with an file watcher utility like entr

    find . -name '*.c' | entr mycc main.c -o main
With Leiningen it has to do that all. AND you pretty much have to use the auto rebuilder capability (which means your workflow starts with turning the auto rebuilder on).

> As far as editors go, I'm perplexed. You can use nearly any editor, why do you perceive the need to use one of these 2?

Then why do nearly all (probably 95%) Clojure devs use either Emacs or LightTable?

Re:Why I'm Productive in Clojure by freshhawk on Wednesday July 23, 2014 @02:17PM (#8075968)
Right now I'm using a combination of leiningen, guard, livereload, compass and a shell script to handle my specific build workflow.

I'm confused as to why you think leiningen has to do it all.

I'm also not sure what you mean by auto rebuilder (for clojurescript I use the auto feature of cljsbuild ...). My workflow starts with starting a REPL.

Also, I use vim very happily, many people use Cursive happily. But the reason there seem to be fewer editors in use is that REPL integration is so useful that only those editors with good REPL features end up being used. Clojure's ecosystem isn't stopping anyone from using other editors, those editors just haven't implemented a specific feature that is extraordinarily useful when writing Clojure.

I may have misunderstood you but it seems like you are seeing problems that don't exist because the solutions look different than what you expect.

Re:Why I'm Productive in Clojure by Touche on Wednesday July 23, 2014 @06:20PM (#8077263)
I think you are misunderstanding. People have shown in this thread that they have a slightly different workflow from each other, but my point was that Clojure(Script) points you towards a particular type of workflow, one that I do not like. What I essentially want is 1 of three things:

1) Fast builds so I can set up an auto-build script.

2) A Leinengen daemon so I don't have to worry about building at all.

3) ClojureScript so I can just refresh the browser.

As far as I can tell none of these are possible. If I am wrong please correct me.

Re:Why I'm Productive in Clojure by freshhawk on Saturday July 26, 2014 @12:51PM (#8090127)
You can certainly get all of that stuff (except fast builds in some particular circumstances).

My project I described before is a web app, and my workflow involves my editor, a browser, a clojure repl, a clojurescript browser repl that runs code in the browser and a shell script that runs the various watchers I described before.

If I change any clojure file the browser refreshes automatically (and my tests run automatically).

If I change any clojurescript file it gets rebuilt automatically and the js file is reloaded in the browser (just the js, not a full page refresh)

If I change any sass file, it gets rebuild and the css in the browser refreshes (just the css)

If I change any html template then, depending on the template, either the page is refreshed or my clojurescript is rebuilt and the js refreshed.

So all those things are possible (I saw a cool post the other day of some ring middleware to handle using clojurescript inside <script> tags transparently).

The non-clojure stuff is handled completely outside of the clojure ecosystem, I was using LiveReload and Guard when doing python dev to get that partial refresh on file save functionality and it was pretty simple to hook clojure into that same workflow.

I will say that if you are doing a lot of compile time template processing in your clojurescript like I am (using Kioo/Om/React.js) then the compile time for the clojurescript can be a little long, but since I have a browser REPL I do my experimental stuff in there instead of hitting that recompile cycle frequently so it's only a minor imperfection in practice.

So I definitely don't worry about building at all, and I don't even have to refresh my browser thanks to LiveReload - I just have to hit save in my editor.

There unfortunately aren't a lot of tutorials for setting this kind of thing up. I've got a start on writing up my setup and will put the project skeleton on github soon-ish ... I have this damn real work that keeps getting in the way.

Re:Why I'm Productive in Clojure by jcromartie on Wednesday July 23, 2014 @11:13AM (#8074773)
I work on a project where people use different workflows and editors.

I use Emacs w/ Cider to connect to a REPL session to develop my application.

Another person uses vim and "lein run" and "lein repl".

Yet another uses Cursive (IntelliJ-based) for everything.

Re:Why I'm Productive in Clojure by adambard on Wednesday July 23, 2014 @11:21AM (#8074829)
I'm not sure how many serious devs use LightTable (although I'd be interested to know!). I keep it handy for writing little scripts (in Clojure, Python or Javascript) that benefit from the interactive style, but I do most of my actual development in Vim. I tried emacs, but I just couldn't stick with it, and the fireplace vim plugin is really great.
Re:Why I'm Productive in Clojure by dj-wonk on Wednesday July 23, 2014 @10:43AM (#8074609)
Leiningen, in my experience, is nicely extensible for what I've needed to do. I've got a project that has to pre-compile Protocol Buffer files. To do that, I use Leiningen profiles.

Have you looked at Leiningen profiles? https://github.com/technomancy/leiningen/blob/stable/doc/PRO...

Plugins? https://github.com/technomancy/leiningen/wiki/Plugins

It seems to me that Leiningen is quite active with its extensibility, especially given how young it is.

If those don't work, have you considered wrapping it with your own scripting?

Have you raised your concerns on the mailing list? People would be open to discussing them.

Re:Why I'm Productive in Clojure by Touche on Wednesday July 23, 2014 @10:55AM (#8074664)
You can't wrap it with your own scripting because compiling is too slow. That's the essential problem, Leiningen has to be the center of your workflow. There's no other (meaningfully productive) way.

What I dislike is the need to run a background task per-project, every time I work on the project. What I would like is either:

1) Faster (sub 500ms) compile times so that I can flexibly use a workflow I prefer.

2) A "Leiningen daemon" that runs when I start my computer and automatically compiles any project.clj files that exist.

3) ClojureScript to build in the browser, so that my workflow can be any text editor + refresh the browser.

Leiningen plugins cannot give me any of those things, correct?

Re:Why I'm Productive in Clojure by nilved on Wednesday July 23, 2014 @11:03AM (#8074706)
Fast JVM startup is possible with a preloader like Nailgun. A Leiningen daemon is very easy to create. lein-cljsbuild automatically generates ClojureScript so you can use any editor and refresh your browser.

The JVM way of doing things is different but not inferior. You extend Leiningen with Leiningen plugins written in JVM languages, not with external tools. Yes, you can do everything you would ever want to do.

Re:Why I'm Productive in Clojure by dj-wonk on Wednesday July 23, 2014 @12:44PM (#8075326)
Grenchman is worth a look too: http://leiningen.org/grench.html
Re:Why I'm Productive in Clojure by DAddYE on Wednesday July 23, 2014 @01:25PM (#8075613)
Thanks for that! Awesome!
Re:Why I'm Productive in Clojure by Touche on Wednesday July 23, 2014 @06:17PM (#8077254)
> Fast JVM startup is possible with a preloader like Nailgun.

This has never worked for me with Clojure. I'd enjoy a more specific example.

> A Leiningen daemon is very easy to create.

Could you explain more? I specifically want 1 Lein daemon for all projects, not 1 per project. I want to be able to create new projects on the fly. I only want this feature because the ClojureScript build process is too slow to do on demand.

Re:Why I'm Productive in Clojure by jcromartie on Wednesday July 23, 2014 @11:13AM (#8074777)
You can of course just have a scripts/ directory with any kind of script to automate any part of your build or development processes.
Re:Why I'm Productive in Clojure by uniclaude on Wednesday July 23, 2014 @12:26PM (#8075204)
> Then why do nearly all (probably 95%) Clojure devs use either Emacs or LightTable?

Why should it even be a question?!

Seeing it this way is a mistake. Most developers use tools they are comfortable with, and beginners use what they see in tutorials.

Now about why this repartition, well: Clojure allows you to work with a REPL. Therefore, it's no surprise that developers stick to the "few" editors that allow this style of development. You can see this going with Scala, too.

This said, nothing I know of in Clojure forces you to stick to those editors. Most Java developers use Eclipse or Netbeans, yet, nothing prevents you to use IntelliJ.

Re:Why I'm Productive in Clojure by dkersten on Wednesday July 23, 2014 @01:31PM (#8075638)
I don't really understand the problem, but FWIW I use vim and its Clojure support is fantastic.
Re:Why I'm Productive in Clojure by deno2 on Wednesday July 23, 2014 @05:19PM (#8077015)
Checkout the awesome hoplon library for a different way: https://github.com/tailrecursion/hoplon