在Clojure命名空间中排除java.lang。* [英] Exclude java.lang.* in Clojure namespace
本文介绍了在Clojure命名空间中排除java.lang。*的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以在Clojure命名空间中从java.lang中排除类名?
Is there a possibility to exclude the classnames from java.lang in a Clojure namespace?
我需要使用Byte和String等变量,这里是java。
I need to use variables like Byte and String, and here the java.lang classnames come into my way.
也许有点像(ns my-ns(:exclude java.lang))吗?
maybe something like (ns my-ns (:exclude java.lang)) ?
推荐答案
如果使用全限定名,则不会有歧义。例如:
If you use the fully qualified name, there's no ambiguity. For example:
user=> (def user/Byte (java.lang.Byte/decode "0"))
#'user/Byte
以这种方式定义Byte之后,Byte将解析为您的定义而无需限定名称
After you've defined Byte in this way, Byte will resolve to your definition without the need to qualify the name
user=> Byte
0
这篇关于在Clojure命名空间中排除java.lang。*的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文