java

2024-10-10T06:44:28.519289Z

I'm being forced to use java + springboot for a project at work, does anyone have any cool Java REPL setups, to retain an interactive programming model? I'm thinking of using tools namespace refresh start/stop to control the lifecycle functions of the springboot app, and then also using the JShell api to evaluate java code at runtime, and also add in a hotswap agent for good measure. So i'd still keep clojure around in my back pocket for development process, but wouldn't commit any clojure code to the repo.

2024-10-11T08:42:12.199379Z

I'm slowly arriving at a working java REPL 🙂

wikipunk 2024-10-11T17:05:38.338509Z

I use Virgil (https://github.com/clj-commons/virgil/) alongside LSP Java for project-aware IntelliSense in Emacs, paired with a Clojure REPL. To reset the state, you can touch a Clojure file in the Virgil post-hook by using .setLastModified on the file you want reloaded. This signals tools.namespace to refresh any components in your system that depend on the updated Java classes.

👍 1
❤️ 3
2024-10-10T20:35:38.165959Z

This might not sound exciting but you can achieve a little bit of an interactive programming experience with careful TDD and breakpoint debugging

👍 2
2024-10-16T09:27:14.916029Z

got a make shift java REPL going, although the devil is in the details if you want a smooth experience.

2024-10-16T09:28:57.027479Z

uses emacs + tree sitter to parse out evaluable snippets / 'sexp' , creating an nrepl socket in the java project ran with maven, connecting to it with cider, and sending the snippets to a clojure wrapper around the jshell api to evaluate.

2024-10-12T12:13:35.583929Z

The debuggers for java are pretty nice, and these allow evaluation of code at runtime. In IntelliJ you can set a breakpoint, step through the execution, and evaluate code. It's not as powerful as what we have in Clojure, but at least it's better than the regular edit-compile-run cycle.