且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 Clojure 中实现 Java 接口

更新时间:2022-06-20 02:15:52

reify 是实现接口的强烈首选 - proxy 是繁重的、陈旧的和缓慢的,所以应该尽可能避免.一个实现看起来像:

reify is strongly preferred for implementing interfaces - proxy is heavy-duty, old, and slow, so should be avoided when possible. An implementation would look like:

(reify Doer
  (doSomethin [this input]
    (...whatever...)))