【发布时间】:2021-02-05 08:09:10
【问题描述】:
当在与 defprotocol 不同的命名空间中使用 extend-protocol 时,我按照 Cursive 的建议导入类。
(ns the.first)
(defprotocol AProtocol
(method [this]))
(ns the.second
(:import (the.first AProtocol)) ; <= Cursive suggested this...
(extend-protocol AProtocol ; <= ...because this wasn't in scope.
AType
(method [this] ...))
我在IllegalArgumentException: interface the.first.AProtocol is not a protocol 上扯了一点头发。
【问题讨论】:
标签: clojure namespaces protocols