On Apr 22, 2010, at 3:15 PM, Konrad Hinsen wrote:
On 22.04.2010, at 18:53, Rich Hickey wrote:
Feedback and errata welcome as always,
One feature in the deftype/defrecord split that I regret is that
defrecord no longer allows the redefinition of equals and hashCode.
Any attempt to override those results in an error message about
duplicate method definitions.
I have several former deftypes that are a perfect fit for the new
defrecord, except that they need a specific comparison function.
This is usually for excluding some fields from equality testing, or
for requiring identity rather than equality for some fields.
It is a design goal of defrecord that the types it creates have
uniform semantics. As soon as you have user-defined equality you can
get broken semantics.
As it is, I must convert all these to the new deftype, losing the
convient field access through keywords.
You can get that back easily by implementing ILookup/IKeywordLookup,
as does defrecord. I still have ideas about macro-like mixins for use
in deftype, but I concluded the mandatory use of such mixins to create
record-like things was too much user effort, and we need more
experience with code reuse in deftype to determine need.
Rich
--
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