在使用Clojure时,我们有以下内容:
(defprotocol Greeter (hello [args] "Say hello"))
(extend-protocol Greeter
String
(hello [this] (str "Hello " this)))
(hello "world") ; "Hello world"
到目前为止,一切顺利。然后我们添加:
(defn hello [args] (str "Wassup " args "?"))
这将改变上一个表单的输出为:
(hello "world") ; "Wassup world?"
有没有办法让协议优先于函数执行?