To comment my own question some years and a bit of experience later: I would say that, just like with type-hinting: hold of as long as possible. Only when you find yourself adding to a map something like: {:type Person} is it time to consider using a Record in stead. And of course also if you would like to dispatch on type (defprotocol / defmethod).
On Monday, September 5, 2011 at 3:46:37 PM UTC+2, Terje Dahl wrote: > > Ref: Stuart Halloway's talk: "Simplicity": > > http://blip.tv/clojure/stuart-halloway-simplicity-ain-t-easy-4842694 > > Found via reading list: http://clojure.com/reading.html ) > > At one point in his talk he states that defrecord is in fact basically > "documented, named [typed] structure". > (as opposed to a standard map). > This I thought was quite genius. > > But on further reflection I wonder if: > > A: Doesn't this contradict another Clojure rationale: > "It is better to have 100 functions operate on one data structure than > to have 10 functions operate on 10 data structures." - Alan J. > Perlis http://clojure.org/rationale > > B: Is this not a form of optimization - (which may be premature)? > > C: Is it best to use records only within an aplication, but to export > to generic maps when "serializing" data to a string og stream for > communication or storage ... > Is this the best way to "serialize" a record?: > (into {} intance-of-my-record) > Would you "desiralize" it with a custom function like this? > (fn [{key1 :key1, key2 :key2}] (MyRecord. key1 key2)) (calling it > like this: (my-fn map-to-be-destructure-and-recordfied) > > > > -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.