Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Clojure, Is it idiomatically correct to use require ... as rather than use... in the ns macro

I'm writing a clojure application which is growing from small to medium sized. We're currently importing modules using

(ns foo (:use bar))
(fn-in-bar)

but I think that switching to

(ns foo 
  (:require [bar :as b])) 
(b/fn-in-bar)

would help with clarity and code comprehension. Is this a good way to do things? Is there a better way?

like image 449
Jim Downing Avatar asked Sep 19 '09 07:09

Jim Downing


1 Answers

Yes. The second form is the prefered approach.

There is some discussion related here

like image 111
Timothy Pratley Avatar answered Oct 13 '22 19:10

Timothy Pratley