![](/img/trans.png)
[英]Difference between definterface and defprotocol in Clojure
[英]How to use definterface in Clojure?
似乎Clojure 1.2.0有一個definterface
形式,顯然是用於創建Java接口,有些人建議使用它(例如, 這個數字運算問題的一個答案)。 但是,我似乎無法找到任何文檔或如何使用它的實質示例。 我不是在尋找合適的地方,還是它實際上是一個不應該被使用的早期功能? 我對指向文檔的示例或演示definterface
功能的示例definterface
。
看看gen-interface
的文檔。
粗略的形式是:
(definterface Foo [bar [Arg1Type Arg2Type] ReturnType] [sideEffects [int] void] ...)
編輯:你是對的。 該接口比gen-interface
更接近defprotocol
gen-interface
。
(definterface Foo
[^int foo [x ^String y]]
[^void bar [^ints is]])
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.