On Mar 20, 2010, at 2:50 PM, cageface wrote:
So will deftype/protocol be the recommended, idiomatic way to
implement ADTs in Clojure 1.2?
Yes.

Will the current map/struct based
approaches essentially be deprecated?

These are two different things. deftypes will work fine with map-based  
code, and doing so is an important part of the design of Clojure. The  
intent here is definitely *not* to start building walled gardens of  
basic data manipulation logic. If you fund yourself writing
(defprotocol Employee
  (get-name [emp]))

you are doing it wrong. We get a lot of leverage in Clojure by having a large set of functions that can generically manipulate data via associative abstractions, and deftype types will often be associative things. Protocols are for adding additional abstractions.
deftype *will* supplant defstruct (or perhaps be used to reimplement it)

The doc here http://www.assembla.com/wiki/show/clojure/Datatypes
suggested to me that they were more for interfacing with Java in a
more efficient manner?
Not at all. They are a very useful abstraction mechanism in their own  
right, even if you never implement an interface or expose to Java.
Rich

--
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

To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or 
reply to this email with the words "REMOVE ME" as the subject.

Reply via email to