Skip to content

Instantly share code, notes, and snippets.

@aperiodic
Last active July 12, 2016 17:11
Show Gist options
  • Save aperiodic/d3c466da51fb8b960fefe466ee203942 to your computer and use it in GitHub Desktop.
Save aperiodic/d3c466da51fb8b960fefe466ee203942 to your computer and use it in GitHub Desktop.
You Can Partially Implement Protocols
(defprotocol Foo
(bar [this])
(baz [this]))
(let [fooer (reify Foo
(bar [_] :bar))]
(bar fooer))
;; => :bar
(defservice foo-service
Foo
[]
(bar [this] :bar))
;; CompilerException java.lang.IllegalArgumentException: Service does not define function 'baz', which is required by protocol 'Foo'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment