File refactoring guide?

As Dave says, you can require the namespace without an alias and then use the whole name in the qualified symbols – but it’s not common and I’d say it’s considered non-idiomatic.

Also, as Dave notes, you can use defn- to declare a function private and ^:private on a def. But private functions and Vars can still be accessed in other namespaces: (#'foo/f :some :args) will still work if f is a private function, as will @#'wibble/v for a private var.

Clojure isn’t the only language where “private” is… advisory… but it’s unusual and therefore something to bear in mind when you’re considering whether to make something private. Often, instead of private, what you’ll see in projects is a separation of API and implementation into two namespaces. The latter commonly has .impl in its name.

3 Likes