开发者

In Clojure why use :only []

开发者 https://www.devze.com 2023-04-13 04:03 出处:网络
The source for lazy-xml has the following: (:use [clojure.xml :as xml :only []] [clojure.contrib.seq :only [fill-queue]])

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消