Re: Deriving a protocol from a protocol...

2016-10-31 Thread Alex Miller
You can of course have one concrete instance implement many protocols. Another clever thing you can do is to extend a protocol to Object, then inside the Object extension check if the instance satisfies? another protocol and if so, extend its type at runtime to the original protocol. Rich sugge

Re: Deriving a protocol from a protocol...

2016-10-31 Thread John Szakmeister
On Mon, Oct 31, 2016 at 5:57 PM, Alex Miller wrote: > You can create instances that implement multiple Java interfaces using > `reify` or by declaring them inline of a `defrecord` or a `deftype`. (See > http://clojure.org/reference/datatypes for more.) Thank you Alex. I should have been more cle

Re: Deriving a protocol from a protocol...

2016-10-31 Thread Alex Miller
You can create instances that implement multiple Java interfaces using `reify` or by declaring them inline of a `defrecord` or a `deftype`. (See http://clojure.org/reference/datatypes for more.) Clojure does *not* encourage or support concrete inheritance (other than of the limited degree provi

Deriving a protocol from a protocol...

2016-10-31 Thread John Szakmeister
I'm looking at using Clojure in an application where we make fine-grained use of interfaces that help describe the capabilities of an object. We need to take several interfaces and bring them together, not necessarily in an implementation, but to help define what the overall interface for the obje