defstruct
is effectively deprecated in the language, in favor of defrecord
. We are supposed to move on in (JVM-based) Clojure, so I would expect Clojurescript to be the same. See the following:
Clojure: data structures: "Note: Most uses of StructMaps would now be better served by records."
ClojureDocs: defstruct comment by steveminer: "Structs are obsolete. Use records instead. See defrecord."
The forthcoming The Joy of Clojure, 2nd ed. (prerelease V9 edition) by Fogus and Houser says "With the advent of defrecord
, the need for structs has been nearly eliminated, and therefore structs aren’t covered in this book." (p. 322)
Also note that Programming Clojure, 2nd ed. by Halloway and Bedra covers defrecord
but not defstruct
(although there are some passing mentions of structures--maybe accidentally left from the 1st ed.).
I guess all the cool people are using defrecord
these days. :-)
Alex Miller's answer to "Where should I use defrecord in clojure?" has a nice discussion of advantages (and disadvantages) of defrecord
, although he's not, primarily, comparing it with defstruct
.
defrecord
: defstruct. We are supposed to move on in (JVM-based) Clojure. I would expect Clojurescript to be the same. – Mars