Records constructed with missing arguments look equal, but aren't
Closed this issue · 3 comments
dfrese commented
When having an RTD-record, and two values of that type, one with argument 'nil', one without any:
(rec/define-record-type FileSource
{:rtd-record? true}
(make-file-source file) file-source?
[file file-source-file])
(def v1 (make-file-source nil))
(def v2 (make-file-source))
then they look equal
(= (pr-str v1) (pr-str v2)
but, aren't
(not (= v1 v2))
which is very confusing. Would be ok to not be able to construct them with missing arguments, but otherwise they should be (=), I would expect.
kaaninho commented
I would say the result of this
(def v2 (make-file-source))
is undefined behaviour. In Clojure, this even throws an ArityException
at runtime.
dfrese commented
Yes, but only because it seems not to be like this anymore.
I get `wrong number of args" now.