In Clojure why use :only []
The source for lazy-xml has the following:
(:use [clojure.xml :as xml :only []]
[clojure.contrib.seq :only [fill-queue]])
What i开发者_运维知识库s the purpose of using clojure.xml
but listing nothing for the :only
arguments?
Notice the :as xml
which when combined with the :only []
seems to make that line equivalent to (:require [clojure.xml :as xml])
. That style might be useful if you want to copy some vars into the local namespace (i.e., a non-empty :only
), but allow the rest of that namespace to be explicitly aliased via :as
. Since that's not what he's doing, it really should just be a :require
.
精彩评论