Idiomdrottning’s homepage

Clojure namespaces

The namespace stuff sucks with Clojure 💔

Instead of

(go 'north)

I need to

(go :atlas.earth.frobnicated.potassium-derived.map-directed/north)

I miss the joy of simple, straight-forward, reusable names, which was one of the first things I fell in love with when I started learning Lisp.

You can alias the name spaces:

(ns my.fantastic.planet
    (:require [atlas.earth.frobnicated.potassium-derived.map-directed :as ok]))
(go ::ok/north)

But in vanilla Lisp you instead more typically use words as words (as opposed to very specific names & identifiers) which to me is more fun, exploratory, extensible, enjoyable etc.

These languages being so extensible, you can of course get one to act like the other (in Clojure, you can just refer all) and vice versa (in Chicken, you can import with prefixes), but I’m in a Clojure code base now where even the aliases are super long at this point.

In Clojure, the intent, idiom, and culture is to use namespaces, and if you’re maverickingly ditching them you only make it even more complicated and inconsistent. One of the many problems with the namespace system is that it’s hard to grep for things, and that’s just gonna be even harder if it there’s even more inconsistency between (status foo) and (frobnication/status foo). I like Clojure, world’s easiest language, but, definitively aspects of it that I’m really sick of. Namespaces being the biggest. That’s a way bigger pain than cosmetic peeves like how unless is named when-not. (If I wanted (when (not foo)) I knew where to find it…)

I like how namespaceless can encourage reuse and mix&match. Namespaceless also makes the functions feel more like tools directly.

Like, if I wanna hit a light switch in my room I don’t first have to open a li’l hatch labeled home.electric.wiring. I can just hit the light switch directly because its interface has been made available to me as resident in the room.

The more time I spend with Clojure, the more bugged I get by the namespaces. Yeah, they prevent key collisions in maps but that wasn’t exactly an every day problem in the before-fore. They make it so that…

Three pretty big costs of namespaces that collectively eat up a ton of time and effort.