Working As Intended

Still looking for a Clojure dev environment

March 16th 2015

I’ve been writing mostly all Clojure code recently. I’m still in search of a decent development environment.

I’ve tried Intellij + Cursive, and it’s decent but the REPL is super clunky. Test integration is terrible, and clearly an afterthought. The editor itself is okay, for an IDE, with the normal amount of having to use the mouse way too much to get anything done.

Lighttable is interesting. It’s super clean, and instarepl is fun to play with. It’s a feature that turns an entire file into a live REPL and shows you the output of every line at once. I can’t remember what exactly started annoying me about this one, but overall it seemed solid. If I were to hand a Clojure project to a newbie, I would use Lighttable for sure. It was close enough to “it just works” to be great for this purpose.

I spent a couple days (again) forcing myself to use Emacs (the clean OS X build). It’s super cool and super annoying all at once. I was getting pretty good at remembering the Cider key combos for evaluating code in the REPL, and that seemed to go well. Emacs integrating with a Lisp interpreter is pretty much the killer feature for me when it comes to Clojure. This has been a solved problem for years, so I would expect it to work well.

Ultimately, I started hating the other arcane key combinations I was supposed to remember that should have been more obvious. For example, I was trying to do a J from vim while in emacs, which joins two lines together. In emacs the command is C-n M-^, which is it’s own special level of insanity (memorize an oddball chord and have to reach M-Shift+6). I know that I could bind this to something else, but I don’t want to bind this to something else. I want it to be designed with humans in mind in the first place (emacs evangelists, unload your vim irony here) . Also, C-j to get a newline with auto-indent? Seriously?

I think I keep trying Emacs, because Brave Clojure loves it so much. This is a really good intro to Emacs and Clojure, and I highly recommend it. I have no doubts that I’ll be back to Emacs sooner or later. I’m sure it’s not done disappointing me yet.

Like every other time I’ve gone through this journey to find a new IDE I’ve ended up back at vim. The interface to nrepl via fireplace is decent, but not without its quirks. It’s good enough to execute code, which is mostly what I want anyway. For autotesting I’ve been using lein quickie. This has nothing to do with vim, so I’ll have to reevaluate my test issues with Lighttable and Intellij in light of this tool.

Now that I’m sort-of-but-not-really happy with my dev setup I’ve run into another issue. My Macbook Pro is out of RAM. Apparently the apps I run, plus multiple JVM’s for the various REPLs that all need to be going at once have put me right up against the 8 GB limit, and everything comes to a crawl. I could play around with JVM settings to buy some room, but it’s probably about time that I throw some new hardware at this problem anyway. I’m writing this on a mid-2012 MBP, like a fossil. I’m considering firing up an EC2 instance as a dev box until the new 15" Macbooks come out this summer.

Finding the source code for a Ruby method.

February 11th 2015

Today I discovered Ruby’s Method#source_location. I was getting strange results in a test case and wanted to see what was going on inside of xhr.

I added a breakpoint to my test.

byebug
xhr :get, :show, id: expected_user.id

And then in the console that came up from running the test I was able to pull up the file and line number for this method.

(byebug) self.method(:xhr).source_location
["/[...]/gems/actionpack-4.2.0/lib/action_controller/test_case.rb", 538]

The Clojure - Elixir Pendulum

February 8th 2015

As I’ve written before I’ve been alternating between Clojure and Elixir on my hobby projects. I did briefly dip into Scala for an online class on functional programming, and while it was interesting I realized that there was no chance I was going to stick with that language for the long term.

My latest reason for switching (in this case from Elixir back to Clojure) is that I can’t be bothered to write roles authorization code from scratch for the umpteenth time. I could (should perhaps) start a roles library project for Elixir and attempt to solve the problem for myself and others. But I’d much rather get something interesting done.

A likely upcoming scenario will be me getting annoyed at either (1) trying to hack Clojure code with vim or (2) realizing that the Clojure roles libraries like friend are as obnoxious as making my own in the first place. Friend might be wonderful; who knows.


Archives

Feed Feed