I was reading "How to Take Smart Notes" and found a quote: > The best way to deal with complexity is to keep things as simple as possible and to follow a few basic principles. > Remind anyone of anything?
Is there a thing to take Java source code and convert it to clojure source code? Presumably one could use something like the https://javaparser.org/ and write some transformers (to take the Java AST and emit clojure source code) and have something that gets you 80% there. Would really be peachy if it could convert the javadoc into clojure function doc.
I have something for that
you have to send me the code in an email and wait a few days for it to run though.
Like this (but for java)? https://roman01la.github.io/javascript-to-clojurescript/
@bherrmann I reckon that such a transformer would emit highly unidiomatic clojure code, e.g. lots of deftype, gen-class, other interop constructs there would also a lot of local mutability, which is not supported OOTB, see e.g. https://github.com/ztellman/proteus So, one can wonder if the result would be worth it
I'm curious @bherrmann what problem a tool like this would solve for you.
Well specifically I'm working in a mostly java world... and upon a occasion I'd like to repl though something... but to get very specific, atm I'm converting this example from Java to Clojure and the process is just tedious... https://github.com/gsuitedevs/java-samples/blob/master/gmail/quickstart/src/main/java/GmailQuickstart.java
as a practical matter... I will just fiddle with the Java code... and set aside the conversion for now...
My thought was to write a thing which reads/polls/events off new messages in my INBOX and reacts to certain email messages by invoking some clojure code on them.
The conversion doesn't look like a lot of work tbh...
normally I'd paste GoogleNetHttpTransport
, then invoke https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-add-missing-libspec for having the relevant :import inserted
I have cljr-add-missing-libspec bound to a particularly handy keybinding, so the whole process isn't too demanding
Yea, the conversion of the single file isnt particularly onerous - just a pita... however if I wanted to convert something more substantial then a tool might be useful...
Maybe a Clojure-based bytecode inspector would be more valuable for that