Ken Wesson <kwess...@gmail.com> writes: > On Sun, Dec 26, 2010 at 7:18 PM, Alex Osborne <a...@meshy.org> wrote:
>> Struct maps were in the language for a long time before defrecord was >> added. Records are supposed to replace them for most purposes. So if >> in doubt between the two use a defrecord. > > Isn't one advantage of structmaps over records that you don't need to > AOT your structmaps? And can thus change them on the fly during > REPL-driven programming, debugging, and experimentation instead of > having to do a discrete edit, build, test cycle? Actually you don't need to AOT compile records or types. They work fine for interactive development. The official struct-map documentation even recommends you should consider using a record instead: http://clojure.org/data_structures#Data Structures-StructMaps > Jumping straight to defrecord might, in some cases, be premature > optimization, too. For business logic, like actual records then certainly, a hash-map is usually preferable unless you need polymorphism. {:name "John Smith", :phone "12345678"} In this case Damon is basically implementing a type though not a record. I probably should have explicitly mentioned that deftype would be a better choice in this case -- that's what the decision tree was supposed to show. Records get you these features, all of which make no sense for a queue object: * value-based equality and hashCode * (immutable) metadata support * associative support * keyword accessors for fields * extensible fields -- 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