Oh, you know me: I avoid AOT and gen-class at all costs _if I don’t have to use 
them_ 😊

Sean Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

________________________________
From: clojure@googlegroups.com <clojure@googlegroups.com> on behalf of Alex 
Miller <a...@puredanger.com>
Sent: Friday, June 21, 2019 1:53:43 PM
To: clojure@googlegroups.com
Subject: Re: Calling Java from Clojure

I just don’t understand why you would introduce aot or gen-class at all if you 
didn’t have to, which is one of the benefits of using the Clojure Java API.

On Jun 21, 2019, at 2:35 PM, Sean Corfield 
<s...@corfield.org<mailto:s...@corfield.org>> wrote:


The approach I’ve taken around :gen-class has been to ensure that the namespace 
offering the Java class via :gen-class has no static dependencies at all – 
instead it requires/resolves any other namespaces/symbols it needs at run time. 
That way AOT creates the .class you need but doesn’t spread to anything else.



This is even easier in Clojure 1.10 with the addition of requiring-resolve 
(which is also thread safe, unlike regular require right now).



But yeah, as Alex indicated, you need to be careful if you have an AOT’d entry 
point and downstream code is not AOT’d. Just one more “here be dragons” aspect 
of AOT, IMO.



Sean Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood



________________________________
From: clojure@googlegroups.com<mailto:clojure@googlegroups.com> 
<clojure@googlegroups.com<mailto:clojure@googlegroups.com>> on behalf of Didier 
<didi...@gmail.com<mailto:didi...@gmail.com>>
Sent: Thursday, June 20, 2019 9:13:40 PM
To: Clojure
Subject: Re: Calling Java from Clojure

Option #1 and #3 are very much the same, just that Option #3 creates a Java 
layer on top, instead of having everything coupled to the Clojure Java APIs 
directly.

When you go with Option #2, you do not have to AOT everything, but AOT is 
transitive. So as you AOT the gen class, all code it requires and all code they 
in turn require will also be AOT. You can post-process the AOT when jaring, and 
only include the gen-class .class files in the Jar and not the dependencies, 
but that's more work.

--
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<mailto: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<mailto: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/1dd84879-6855-4893-99ee-de15ea6a6329%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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<mailto: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<mailto: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 a topic in the Google 
Groups "Clojure" group.
To unsubscribe from this topic, visit 
https://groups.google.com/d/topic/clojure/aejqMwraPk8/unsubscribe.
To unsubscribe from this group and all its topics, 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/CY4PR2201MB11266042416A0BEFDBB233C6F4E70%40CY4PR2201MB1126.namprd22.prod.outlook.com<https://groups.google.com/d/msgid/clojure/CY4PR2201MB11266042416A0BEFDBB233C6F4E70%40CY4PR2201MB1126.namprd22.prod.outlook.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
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/D9D7F343-1BDC-4257-9FAD-BBEA5A613DE1%40puredanger.com<https://groups.google.com/d/msgid/clojure/D9D7F343-1BDC-4257-9FAD-BBEA5A613DE1%40puredanger.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

-- 
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/MWHPR2201MB1134A8D8F21815EBF4752BE9F4E60%40MWHPR2201MB1134.namprd22.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to