On Fri  2 Aug 2013 at 04:32:32PM -0400, Lee Spector wrote:

> I can believe that these assertions are true in some (maybe many)
> programming contexts, but from other perspectives anything that
> requires you to type stuff that's not directly about the problem
> you're trying to solve or the idea you're trying to express can be
> seen as an anti-feature.

Of course, this is the tension of simple vs easy. Coming from languages
like C and Ruby, the explicit namespacing in Clojure is a breath of
fresh air, and one of my _favorite_ features of the language.

"Let's keep adding header files until it compiles", and "let's mixin
this entire module for a single method" is easy at first, but you're
adding a lot of incidental complexity for comparatively little gain.

For example, tightly controlled namespacing is what allows Golang to
compile at ludicrous speed, and even relatively small programs can
become incomprehensible when they fall into the hole of super calls and
method shadowing.

> In my own case I generally don't want to spend my time maintaining
> catalogs of all of the locations of the functions that I call or
> cluttering up function calls with project plumbing; I want to spend my
> time thinking about and developing and testing my algorithms.

…

> I'd personally like it even better if you could accomplish the same
> thing without listing the conflicts explicitly, but I'm sure that will
> seem totally nuts to others.

It has been mentioned before, but if you are going to depend on tools
to manage vars for you, why not use Slamhound?¹ It's quality DWIM: do
what's easy, Slamhound makes it simple.

It will take the following buffer:

    (ns example)

    (split (trim " hello, world. ") #",")

and transform it into:

    (ns example
      (:require [clojure.string :refer [split trim]]))

    (split (trim " hello, world. ") #",")

It also removes unused :refers, so it's useful for cleaning up a
namespace after refactoring.

I have the call to slam.hound bound to a key sequence in my editor², so
I do not have to suffer a context switch:

    https://gist.github.com/guns/6144732

There remain a few small problems (and one admittedly large one WRT
macros), but I think automated ns management is a killer feature for
Clojure.

I found hacking on the Slamhound codebase straightforward, so I
encourage people to send patches for any small annoyance they might
have. (it's easy!)

    guns

¹ https://github.com/technomancy/slamhound
² I'm pretty sure technomancy has something similar for Emacs users.

Attachment: pgp_ov2P9N9Pm.pgp
Description: PGP signature

Reply via email to