Recently I stumbled over a bug in defrecord:
(defrecord Foo [this that])
(let [a-foo (new Foo :a :b)]
(with-meta a-foo {:foo :bar}))
This causes a StackOverflowException. The reason is the implementation
of withMeta in the IObj interface. Its first argument is "this" which
shadows the field name "this". The same problem occurs with other
methods and other field names. In fact, all method arguments in
defrecord and some of the locally bound variables would have to be
gensyms to avoid this kind of problem.
Shall I create a ticket for this?
BTW, I have a defrecord implementation that avoids this problem, but
it is not exactly a patch, considering that is relies on non-trivial
template expansion code:
http://code.google.com/p/clj-methods-a-la-carte/source/browse/examples/defrecord.clj
Konrad.
--
You received this message because you are subscribed to the Google Groups "Clojure Dev" group.
To post to this group, send email to
cloju...@googlegroups.com.
To unsubscribe from this group, send email to
clojure-dev...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/clojure-dev?hl=en.