Welcome! Please see the About page for a little more info on how this works.

0 votes
in Compiler by

Currently IFn, IDererf etc implemented as interfaces in clojure but these are protocols in clojurescript.
Are there any plans to fix this mismatch?

1 Answer

+1 vote
selected by
Best answer

Clojure's implementation was created long before protocols existed. ClojureScript had the benefit of a lot of hindsight and a different performance profile.

There are no plans to change the current implementation as it would be difficult to do so while maintaining both performance and backwards compatibility for the many external users and implementors of these interfaces.

Let's also mention that interface dispatch is faster, and interfaces support primitives. This is important only in some contexts, but these contexts are very important on the infrastructure level.
Correct! Although protocol dispatch for inline impls (records/types) is interface dispatch, so can be same speed in that case.
Welcome to Clojure Q&A, where you can ask questions and receive answers from members of the Clojure community.