gpt4 book ai didi

clojure - Clojure 中 definterface 和 defprotocol 的区别

转载 作者:行者123 更新时间:2023-12-02 08:31:37 31 4
gpt4 key购买 nike

除了缺乏文档之外,Clojure 中的 definterfacedefprotocol 之间还有什么区别?

最佳答案

根据Clojure 的乐趣:

The advantages of using definterface over defprotocol are restricted entirely to the fact that the former allows primitive types for arguments and returns. At some point in the future, the same advantage will likely be extended to the interfaces generated [by protocols], so use definterface sparingly and prefer protocols unless absolutely necessary.

关于clojure - Clojure 中 definterface 和 defprotocol 的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7770282/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com