I recently read the article

http://www.colourcoding.net/blog/archive/2011/10/25/clojure-is-a-get-stuff-done-language.aspx?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+ColourCoding+%28Colour+Coding%29

and it mentions in the "Better than a better java" section, that "Compojure 
defines a protocol called Renderable that allows you to specify how return 
types get converted into Ring responses.  Now, you could apply an adapter 
pattern in most languages to link these two up.  In Clojure, you can 
declare that a type implements a protocol and it*just works*.  You don’t 
need to extend the type; you don’t need to monkey patch it; you don’t need 
to introduce a proxy object under your control."

What does the author mean by "don't need to extend the type" but only need 
to "declare that a type implements a protocol?"

I am familiar with extend, and extend-type, or extend-protocol, but not 
JUST declaring a type implements a protocol and it magically works. From 
what I know, you always have to specify the implementation, even if the 
implementation is simply delegating it to some other function.

Best,
Brent

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to