Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Nightcode, the Clojure IDE, just hit 0.1.0 (nightcode.info)
68 points by gw on Sept 25, 2013 | hide | past | favorite | 41 comments



This is the second IDE announcement on the front page in 2 days (the other one being PyCharm).

So far I have resisted the temptation to use an IDE. Whenever I thought I needed a feature from an IDE, I investigated how to achieve it in Vim. I've become a reasonably advanced Vim user, and I feel very productive in it.

Am I a dinosaur on its way to extinction? Or can none of these new IDEs match the power of Vim?


I actually wrote the initial release of Nightcode with Vim. I definitely don't expect many seasoned Vim/Emacs users to switch any time soon. I intended Nightcode to be a great "ready-made" way of getting started with Clojure, because it has everything you need built in. That's not to say advanced users can't find it useful, though. I now work on Nightcode using Nightcode itself, as a way of dog-fooding my own software.


Quick question as a guy learning Clojure currently:

I'm using LightTable right now, and thoroughly enjoying the Clojure experience. Can you explain what you see are the key differences in Nightcode vs. LightTable? I'm curious, because I would love to hear the thoughts of Nightcode's creator on this. I'm planning on giving Nightcode a try tonight.


I think Light Table is more innovative, while Nightcode has a more "all-in-one" experience, bundling its own copy of Leiningen along with a few of its plugins for ClojureScript and Android development. Additionally, if it matters to you, Nightcode is free software (public domain), supports paredit mode, supports Java, and is entirely JVM-based rather than browser-based.


Frankly, yes. The code completion, inline documentation, refactoring, etc, in a modern IDE (especially IntelliJ products) is will beyond whats acheiveable in Vim. And there's always IdeaVim so you don't have to give up your muscle memory.


Let's exclude Java for a second, as it's verbose syntax and baroque directory structures almost require you to use an IDE. My languages are Python, C, C++ and some Haskell and Clojure.

> code completion:

Vim has Omnicomplete. But usually I find it easier to have a web browser side by side and look up function names, in the case I don't remember.

> inline docs

Same here: mostly by memory, and always a web browser open

> refactoring

I do these by hand, usually assisted by the venerable "grep".

My typing is pretty quick, and it is almost never the limiting factor. My limiting factor is usually thinking about how to decompose a problem, and writing tests. Not sure an IDE can help me there.

That said, I should probably give an IDE a try sooner or later.


Ok, fine, but an Idea can save you from having to retype whatever your're searching for into a browser, plus semantic awareness.

For example, I'm currently editing a python file in IDEA.. I can easily, with one (chorded keystroke), see the definition of any symbol in my code, wether it be a local variable or a module. Similarly I can easily pull up docs, find any other usage of that symbol in the current file, etc. There is also high quality linting going on all the time, that will highlight things like unused variables, pep8 violations, etc.

Can you do all of this in VIM? Probably, but only with substantial effort.

As far as refactoring...IDEA goes way way beyond what you can do with grep.

For instance, say I have a function foo:

    def foo(x):
      return x * 2

    foo(3)
This is a trivial example, but just go with it.

What if I decide I need to multiply by things other than 2... fine,

    def foo(x, y): 
      return x * y

    foo(3) # Ooops, syntax error
Now, I can add y as an optional parameter,

    def foo(x, y=2)
... and that way I don't break code I've already written. But that may not be what I want - maybe I want to force callers to explicitly specify both parameters.

That's what refactoring comes in.

Refactoring -> Change Signature (Or just hit Ctrl+F6)

Now, add a new parameter, y, with a value of 2, and now any existing calls to foo across my entire project will have a second parameter of 2. No grepping or manual editing needed. This works reliably over a huge codebase with hunderds of files. Lets see you do THAT with grep. That's just a trivial example.

I can also easily extract a bit of code as a new function, and IntelliJ's code analysis will detect any values I'm closing over and default to those as the function parameters, and replace the original call site with a call to the new function. Again, totally useful, painless, and not doable with grep.


I find myself often using vim to write new code, and IDEs to perform routine adjustments like this one (or to do anything in Java). But, if I have to do really routine stuff, I bounce back to vim for the macro system, which truely blows away any IDE equivalent I've ever tried.

(Also, syntastic+pyflakes for vim provides auto-linting and pep8 checking automatically for basically no effort).


"My typing is pretty quick, and it is almost never the limiting factor."

Oddly enough, that's usually the objection I get when I tell people they should learn vim :)


On the other hand, does an IDE add that much value to python and clojure? For Java, I can see the benefits, but given that these scripting languages are much more lightweight, that's why emacs/vim do alright for them?


Let's suppose you define a function that searches:

FindThis(needle, haystack):

Then later you come to use this function, you cannot remember whether you made it Findthis(needle, haystack) or FindThis(haystack, needle). (OK so in python you could just name your arguments to avoid the issue but then you might have inconsistent coding styles)

IDEs' have completion of code and descriptions of arguments which makes calling any function trivial. You can go from barely remembering a function name to understanding all the parameters, optional or otherwise, within the time it takes you to type out the function you wanted. It means you don't have to context switch into "documentation" mode.


I agree this is useful, but I also have autocompletion and popover documentation programming Clojure in Emacs. It often is more work to configure than just using an IDE, but the package manager Emacs recently added has taken a lot of the pain out of it. There are still cases when I use IDEs (certainly for Java), but you can add a lot of that functionality to emacs/vim if you want.


I can't speak to a feature to feature comparison, but heres some key features you get with counterclockwise.

Automatching parens (parenedit?), rainbow parens if you want, a built in repl, and after your repl is started for the namespace you are currently editing, auto suggest for any namespace in dependency graph. Viewing any included namespace code is simple as a double click - very helpful for learning clojure. Edit the file and after a key combo, your repl has your new function definition.

Counterclockwises workflow is pretty nice. I like it. I don't even have to go to command line to update deps, just edit project file and right click update dependencies. The only thing I use the command line for currently is lein ring server.

Eclipse has the concept of templates which you can define for other content types, but CC's editor isn't enabled to use them. I sort of missed them at first, but didn't after I realized anything I would put into a template should probably be a macro in clojure.


I'm a huge fan of vim-fireplace[1] (and almost every other tpope vim plugin). vim-fireplace provides essentially all of the functionality listed above through a lein nREPL connection.

[1] https://github.com/tpope/vim-fireplace


Yup, I love fireplace. After a bit of fiddling my Clojure setup was better than my Python setup ever was. But for rainbow parentheses, you need also https://github.com/kien/rainbow_parentheses.vim


IDEs were born from Lisp and Smalltalk environments, both dynamic languages.

IDEs can give you:

- code navigation

- code validation as you type

- background compilation for languages with native compilers

- semantic refactoring

- integration with source control and issues trackers, allowing to map source code lines to issues and code history

- WYSIWYG design of user interfaces

- live static analysis while typing

- direct mapping between templates and code behind associated with them

- ...


Very very good.

However when I have a project with imported namespace

(ns project.core (:require [seesaw.core :as s]))

then when I write s/ and hit ctrl+space, the autocompletion does not see the stuff defined in that namespace.

Do you plan to add this support to the editor, or it would be too big pain?


I'll make a note of this, thank you.


Nice work! The interface looks clean and, so far, everything is pretty easy to use.

A small note, I was able to get a default android target to Run but Build crashed. It looks like the Build option isn't pulling in the android.jar file ...


Just wanted to alert you that the issue has been fixed and will be pushed out in the next release.


Thanks, I'll look into that.


A thought for you. Put up an image that hasn't been scaled for your screenshot. It looks fuzzy and indistinct, not the best first impression.


Nicely done - very impressive set of capabilities for an early release. Definitely interested in trying and learning more about Clojure with it.


Wow, this looks brilliant! I think this is what will finally persuade me to play with Clojure more. Public domain license as well... Nice work.


We already have an IDE, it's called emacs.


"We already have transportation, it's called horses".


A horse can do better than a Jeep, when the terrain gets rough, you don't have access to fuel, you don't want to make too much noise,...

Horses for courses, as it were.


So, you're saying paper is better than Emacs when you don't have a computer nearby.


Yes.


Maybe it's just me, but emacs is a huge pain to get set up on windows. I've been happy using lighttable for clojure hackery lately.

This looks cool too, especially the android/java integration.


Yes, it's a very huge pain in the back to get it set up right and get used to it, but it was worth it. I use it (for Clojure and Python) when I can not get modern IDE.

However I checked counterclockwise after a long period of time - and there is almost nothing I miss. Eclipse is not my cup of tea (I'm IDEA user, let the Holy IDE War begin :) ), but more pleasant experience than emacs.


Doesn't Rich Hickey use emacs (aquamacs) for his development?


It is a Lisp environment with a builtin text editor, not an IDE.


Speak for yourself. Not everyone using clojure uses emacs.


I use Emacs for Clojure development (and pretty much everything else) and still think there should be a project like Nightcode. I frown everytime someone recommends Emacs to a newbie interested in Clojure (and hasn't used Emacs before). There is a lot of yak shaving to get the whole thing work (and comfortable) to scare away anyone.


Very true. I use Emacs myself, and I am happy to show it off and rave about its merits to felliw developers. But I don't recommend it to newbies. Newbies have enough on their plate with learning a new language. They don't need any distraction from that.


This just works, great

but where is the documentation? I also checked the github page, nothing there too


What ui toolkit is this using?


It is using the Clojure seesaw library, which is a wrapper around Swing. The theme is the Graphite skin from the Insubstantial project.


Great to know, plus points for using desktop libraries and not some HTML 5 wrapper thingie.


Nice work, I will surely have a try.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: