Ok, so after a bit of more thinking/reading, I realise now that my question was somewhat misplaced.

Any AOT compiled code (not just gen-class), is an artifact of the compiler used to compile it, and therefore, in some sense, implicitly tied to that compiler version. However, that's not to say that the produced class definitely will or won't work with some other version. If my understanding is correct, it will work for future versions (which is the main point here) as long as Clojure itself maintains backwards compatibility (in this case wrt to gen-class).

I'm still torn on whether to actually add Clojure as a proper dependency - I think I will probably end up doing so, but I'm not thrilled about it...

Kind regards,

Dimitris


On 23/08/2019 08:15, dimitris wrote:

Why would I write the class in Java, when this below works exactly as expected?

(ns foo
   (:gen-class :name foo.Bar
               :extends java.lang.System$LoggerFinder
               :constructors {[] []}))

(let [slm (delay (-> 'foo/system-logger-memo
                 requiring-resolve
                 var-get))]
   (defn -getLogger
"Returns a subclass of `System$Logger` which routes logging requests to the `core/*root*` logger." [this name module] ;; resolve it at runtime (and only once), ;; in order to prevent AOT leaking out of this ns (@slm)))


My question boils down to this:

Let's say that I used clojure1.10 to compile the above gen-class. Does the project containing it need to specify Clojure 1.10 as a proper dependency, or will the end user be able to provide any version of Clojure greater or equal to 1.10?

Thanks in advance...

Kind regards,

Dimitris


On 23/08/2019 02:00, Matching Socks wrote:
You are considering gen-class as an alternative to writing the service-provider class in Java and using only methods in Clojure's public Java API to connect it with an implementation-in-Clojure?
--
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
---
You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com <mailto:clojure+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/clojure/0660b640-cf91-429b-9a40-1695e7955aef%40googlegroups.com <https://groups.google.com/d/msgid/clojure/0660b640-cf91-429b-9a40-1695e7955aef%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
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
--- You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/301cea19-425f-85cd-9eb7-ef8e81e58d2d%40gmail.com.

Reply via email to