[CLJ-1208] Namespace is not loaded on defrecord class init Created: 03/May/13 Updated: 11/Mar/15
|Fix Version/s:||Release 1.8|
|Labels:||compiler, defrecord, deftype|
|Attachments:||0001-CLJ-1208-load-own-namespace-in-deftype-defrecord-cla.patch 0001-CLJ-1208-load-own-namespace-in-deftype-defrecord-cla-v2.patch 0001-CLJ-1208-load-own-namespace-in-deftype-defrecord-cla-v3.patch|
|Patch:||Code and Test|
As a user of Clojure interop from Java, I want defrecords (and deftypes?) to load their namespaces upon class initialization so that I can simply construct and use AOT'd record classes without manually requiring their namespaces first.
Calling the defrecord's constructor may or may not result in "Attempting to call unbound fn" exceptions, depending on what code has already been run.
This issue has been raised several times over the years, but I could not find an existing ticket for it:
|Comment by Nicola Mometto [ 18/Jan/15 7:10 AM ]|
The attached patch approaches this issue by adding a :load-ns options to deftype/defrecord which defaults to false.
The patch has two known limitations:
|Comment by Nicola Mometto [ 22/Jan/15 12:59 PM ]|
Updated patch fixing a whitespace error and mentionint :load-ns in the docstrings of deftype/defrecord
|Comment by Nicola Mometto [ 11/Mar/15 6:12 AM ]|
Updated patch so it applies on lastest HEAD