In Clojure 1.4 what is the use of refer within require?

前端 未结 3 1651
误落风尘
误落风尘 2020-12-07 14:39

What advantage does using :refer in :require have over using :only in :use? Are the following synonymous?



        
3条回答
  •  天命终不由人
    2020-12-07 14:57

    As of the 1.4.0 release, there's no longer a good reason to use use. Use require :refer instead. From the Clojure 1.4.0 changelog: "require can now take a :refer option. :refer takes a list of symbols to refer from the namespace or :all to bring in all public vars." (from https://8thlight.com/blog/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html)

提交回复
热议问题