(check-implements obj-type protocol & {:keys [available-methods]})Verify that a type T implements a protocol (as defined with defp).
A protocol is considered satisfied if, for every method in the protocol, there exists a multimethod implementation with dispatch value T
[obj-type protocol & {:keys [available-methods]}] obj-type: should be the dispatch value that is used for multimethods. for objects defined via deft, this is the keyword, so (deft Shape ...) would result in ::Shape protocol: the protocol to implement. If you define it with (defp Drawable ...) it's the variable stored in Drawable available-methods: a list of methods to restrict to. it's like saying, check if this protocol is satisfied, but assume that we can only see the value of these methods. It's useful for checking that all of the methods are defined in the same place (and not sporadically). If its nil, then it does no extra filtering.
Verify that a type T implements a protocol (as defined with defp).
A protocol is considered satisfied if, for every method in the protocol,
there exists a multimethod implementation with dispatch value T
[obj-type protocol & {:keys [available-methods]}]
obj-type: should be the _dispatch value_ that is used for multimethods.
for objects defined via deft, this is the _keyword_, so (deft Shape ...)
would result in ::Shape
protocol: the protocol to implement. If you define it with (defp Drawable ...)
it's the variable stored in Drawable
available-methods: a list of methods to restrict to. it's like saying, check
if this protocol is satisfied, but assume that we can only see the value of
these methods. It's useful for checking that all of the methods are defined in the same place
(and not sporadically). If its nil, then it does no extra filtering.
(prefix-keys ns-name m)cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |