Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> didn't alert me until I tried running the program

That's because that's not how Clojure developers normally work. You don't do changes and then "run the program". You start your REPL and send expressions from your editor to the REPL after you've made a change you're not sure about. So you'd discover the missing argument when you call the function, directly after writing it.




Interesting. How exactly that looks? Do you have files opened in your editor, change them then go into previously opened repl, and just call the functions and the new version of those function runs?


That's right. You typically would have your text editor/ide open, and the process you're developing would expose a repl port which your editor can connect to. As you edit the source code, that will automatically update the code running in the process you're debugging. See this demo of developing a ClojureScript React Native mobile app published yesterday: https://youtu.be/3HxVMGaiZbc?t=1724


Thanks to the dynamic nature of Clojure programs, experienced Clojure developers use the REPL-driven development workflow as demonstrated in this video [1].

[1] https://youtu.be/gIoadGfm5T8


From what I understand, instead of writing the file and running the file you write separate statements in the file and evaluate each of them in the repl (like with "Do it" in Smalltalk).

So what you get, after running the file afterwards from clean state might be different than the result of your selective separate manual evaluations.

This looks like exactly the opposite of the F5 workflow in the browser where you can run your program from clean state with single keypress.

I haven't watched the video till the end though maybe there's a single key that restarts the repl and runs the files from clean state here too.

At first glance you could have the same workflow with JS, but there's not much need for it because JS VMs restart very quickly and also you'd need to code in JS in very particular style, avoiding passing function and class "pointers" around and avoid keeping them in variables. I guess clojure just doesn't do that very often and just refers to functions through their global identifiers, and if that's not enough, even through symbols (like passing the #'app in this video instead of just app).


Almost. I don't actually ever navigate to the REPL process itself. I have my source files open in my editor, and when I want to evaluate something, I select the expression to evaluate and press my shortcut to evaluate it. Then my editor shows the results of the evaluation either inline or in a separate window next to the call.

So when I later call the function I created for example, it'll use the new evaluated code instead of the old. If I'm happy, I save the file, everything reloads from there while keeping the same state.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: