So if I do this in a clean REPL
Clojure 1.2.0
user=> (defprotocol Foo (bar [this x]))
Foo
user=> (defrecord fooed [] Foo (bar [this x] (* 2 x)))
user.fooed
user=> (defprotocol Foo (bar [this x]))
Foo
user=> (extend-type Object Foo (bar [this x] (/ 2 x)))
nil
user=> (def fooey (fooed.))
#'user/fooe
Perhaps I should have explained why I think 20 should be the right
answer.
This is based on my expectation that once I've compiled a file the
behavior of records or types defined in that file will not change
(unless I re-bind functions called by the record or type). The above
behavior violates thi
is x] (/ 2 x)))
> nil
> user=> (def fooey (fooed.))
> #'user/fooey
> user=> (bar fooey 10)
> 20
>
> On Aug 25, 8:55 am, DeverLite wrote:
>
>
>
> > So if I do this in a clean REPL
>
> > Clojure 1.2.0
> > user=> (defprotocol Foo
Thank you Stuart. All the years of thinking about functions as being
subservient to objects has warped my brain. I believe I've read about
this inversion for protocols before but I don't think I've really
grasped all the consequences of it until now.
What I'm taking away from this is that it is pr
He may have some interesting points but...
Anyone who makes grandiose claims and can't bother to give credit to
the people who have helped them along the way deserves to be ignored.
On Nov 27, 11:36 pm, Duane Searsmith wrote:
> I thought his blog had some interesting points. I enjoyed reading i