On Jan 18, 2011, at 1:02 PM, Ken Wesson wrote: > On Tue, Jan 18, 2011 at 12:37 PM, Alan <a...@malloys.org> wrote: >> defstruct is old and I'm pretty sure there's no reason to use it. >> defrecord is a drop-in replacement though for something simple and not >> performance-sensitive you might consider just using hashmaps. > > Agree, but in a case like this there's no strong reason to change it > after-the-fact; at least none that I am aware of.
I haven't looked at the OP's context for this, but I rather like defstruct and I want to ask about its status. I see some mention on the web of it being deprecated in 1.2 (e.g. in http://stackoverflow.com/questions/4288360/clojures-macro-define-a-binding-whose-name-is-composed-from-an-argument). Is this true? That is, is the removal of defstruct from the language anticipated? At http://clojure.org/data_structures I see only the milder statement that "Note: Most uses of StructMaps would now be better served by records." At http://clojure.org/datatypes there's a more directive "Overall, records will be better than structmaps for all information-bearing purposes, and you should move such structmaps to defrecord." But I don't see anything about planned removal from the language at clojure.org. Why do I care? I'm sure I could get over it but a couple of months ago I switched a project from defstruct to defrecord and found that it didn't make any noticable difference to performance (in that application!) and that I missed the elegance and flexibility of having all of my data structures be maps. I don't recall exactly what the issues were, just that they were minor but nonetheless I preferred the struct-map approach. So I switched back. Whatever the benefits of records are, I would anticipate preferring struct-maps and defstruct in some cases. Will that still be supported? Thanks, -Lee -- 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