> You can get hold of a protocol's implementation for a particular type
> if it was attached to a type with extend / extend-type /
> extend-protocol:
>
Yes, but it's unofficial, undocumented and, as you've stated already, can't
be used with inlined implementations.
> Implementations spec
Ok, it seems I cannot make it work unless the "get-method" for protocol is
available,
The reason is, in the example by Michal, the return value from "(get-in
IFoo [:impls user.Bar :foo])" is a Java function, not a true Clojure
function with true dynamic typing. So, take the same example:
(def
Michal:
Thanks a lot. This is very helpful. I have not given much thought yet on
the implementation, but there seems to be obstacles:
1. get the protocol method implementation dynamically (your suggestion
solved part of it)
2. metadata can only be attached to symbols, not the types themselves.
On 3 July 2012 18:40, Vinzent wrote:
> Well, as far as I understand, protocols was made as they were on purpose, so
> inability to create hierarchies is a "feature" (like it or not), while the
> lack of `get-method`-like thing is clearly a defect (in my mind).
You can get hold of a protocol's imp
On Tuesday, July 3, 2012 12:40:24 PM UTC-4, Vinzent wrote:
>
> Well, as far as I understand, protocols was made as they were on purpose,
> so inability to create hierarchies is a "feature" (like it or not), while
> the lack of `get-method`-like thing is clearly a defect (in my mind).
>
> Anyway
Well, as far as I understand, protocols was made as they were on purpose,
so inability to create hierarchies is a "feature" (like it or not), while
the lack of `get-method`-like thing is clearly a defect (in my mind).
Anyway, you have multimethods which can do almost anything, so I think it'd
b
On Tuesday, July 3, 2012 4:18:44 AM UTC-4, Vinzent wrote:
>
> I believe the protocol's analogue for get-method would be enough.
>
>
>
If here you mean we just need to use get-method to directly reuse a
protocol method anywhere, I think that is not adequate. We need to maintain
the hierarchy s
inherit/clojure/mr-o9sRyiZ0/oM4zRz4dXYsJ
>
> I am thinking: conceptually, for code reuse, is it a good idea to have
> protocol specific type hierarchy? I mean something like this:
>
> (defrecord a [x y z])
> (defrecord b [x y z])
> (defprotocol p (foo [this] "Hi"))
> (r
When I re-read the thread "defrecord with inheritance"
https://groups.google.com/forum/?fromgroups#!searchin/clojure/inherit/clojure/mr-o9sRyiZ0/oM4zRz4dXYsJ
I am thinking: conceptually, for code reuse, is it a good idea to have
protocol specific type hierarchy? I mean something