{"id":4229,"date":"2014-03-30T09:24:46","date_gmt":"2014-03-30T09:24:46","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/how-can-a-static-initializer-be-defined-using-gen-class-collection-of-common-programming-errors\/"},"modified":"2014-03-30T09:24:46","modified_gmt":"2014-03-30T09:24:46","slug":"how-can-a-static-initializer-be-defined-using-gen-class-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/how-can-a-static-initializer-be-defined-using-gen-class-collection-of-common-programming-errors\/","title":{"rendered":"How can a static initializer be defined using gen-class-Collection of common programming errors"},"content":{"rendered":"<p>I don&#8217;t believe this is possible in pure <code>gen-class<\/code> at present. clojure&#8217;s gen-class always generates a static initializer where it ties the generated class to the clojure runtime with a call to<\/p>\n<pre><code>clojure.lang.Var#internPrivate(String, String)\n<\/code><\/pre>\n<p>There is some flexibility in the generation of that static initializer (see the <code>:load-impl-ns<\/code> option to <code>gen-class<\/code>), but there isn&#8217;t a way to add your own custom code to the initializer that I can see after reviewing genclass.clj.<\/p>\n<p>btw &#8211; as a slight aside, in the JVM the name of the static initializer &#8216;method&#8217; is<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I don&#8217;t believe this is possible in pure gen-class at present. clojure&#8217;s gen-class always generates a static initializer where it ties the generated class to the clojure runtime with a call to clojure.lang.Var#internPrivate(String, String) There is some flexibility in the generation of that static initializer (see the :load-impl-ns option to gen-class), but there isn&#8217;t a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4229","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4229","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4229"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4229\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4229"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4229"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4229"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}