I think defrecord has 5 downsides compared to regular map. 1. The literal of regular map is eye-friendly and portable. However I still don't know how helpful instant literals added in clojure 1.4 is for records.
2. The construction of record depends on an order of arguments. Sometimes, I feel that a lack of construction with key-value style is not convenient. 3. Replacing all regular maps to records simply make code volume increase. 4. Records easily loose their type. (merge {:c 3 :d 4} (Foo. 1 2)) ;=> {:a 1, :b 2, :c 3, :d 4} 5. Regular map is a persistent data structure, which has internally efficient tree data structure, but record is compiled into class with fields as something like POJO. I suspect efficiency of record when repeated assoc/dissoc. But I could be wrong. Regards, Takahiro. On Monday, July 23, 2012 12:54:03 PM UTC+9, Warren Lynn wrote: > > I don't think you're in the minority. I prefer regular maps to records > >> in general. struct-map was deprecated "a long time ago" (in Clojure >> 1.2). clojure.java.jdbc stopped using struct-map a while back - at the >> recommendation of Clojure/core - in favor of regular maps. >> >> Chas Emerick's flowchart is very helpful here I think: >> >> http://cemerick.com/2011/07/05/flowchart-for-choosing-the-right-clojure-type-definition-form/ >> >> >> > Could you elaborate a little bit more? I know there is a chart, but the > chart does not tell you why. Again, if record provides everything a map can > provide, why would you prefer regular map? I thought at most you would say > "it does not make much difference", and that would mean "no harm" to me. > -- 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