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

+1 vote
in Docs by
retagged by

In ClojureScript one can provide default protocol implementations as follows:

(extend-type default 
  AProtocol (f [] ...))

This is nicely documented in ClojureScript's extend-type docstring:

  • default, meaning the definitions will apply for any value,
    unless an extend-type exists for one of the more specific
    cases below.
  • nil, meaning the definitions will apply for the nil value.

It may worthwhile to document how one can provide default implementations for protocols in clojure as well, by using extend-type for Object & nil, on extend-type clj docstring. On the website is documented already.

1 Answer

0 votes

Logged improvement request as https://clojure.atlassian.net/browse/CLJ-2595