Vincent Chen <noodle...@gmail.com> writes: > - Use something else than records to model structs (suggestions welcome)?
Maps. Records have concrete Java types, which allows them to implement interfaces and participate in protocols. Fields defined on a record type are backed by JVM object fields, which can increase performance. But there are no strictness benefits – a record may have any number of additional keys associated to values: (defrecord Foo [bar]) ;;=> user.Foo (map->Foo {:bar 1, :baz 2}) ;;=> #user.Foo{:bar 1, :baz 2} (class (map->Foo {:bar 1, :baz 2})) ;;=> user.Foo So my suggestion would be to instead turn your `struct` definitions into functions validating that the expected fields are present within plain maps. (Assuming some sort of strictness/validation is the goal.) -Marshall -- -- 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/groups/opt_out.