Fork me on GitHub
#off-topic
<
2020-09-20
>
jaide13:09:21

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?

💯 3
bherrmann14:09:56

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.

vemv16:09:05

@U0502D2GL 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

chepprey16:09:18

I'm curious @U0502D2GL what problem a tool like this would solve for you.

bherrmann17:09:02

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

bherrmann17:09:05

as a practical matter... I will just fiddle with the Java code... and set aside the conversion for now...

bherrmann17:09:01

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.

vemv17:09:46

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

bherrmann20:09:48

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...

sova-soars-the-sora21:09:47

Maybe a Clojure-based bytecode inspector would be more valuable for that

emccue18:09:29

I have something for that

emccue18:09:04

you have to send me the code in an email and wait a few days for it to run though.