Live data from Hacker News

REPL vs CLI: IDE wars

vlaaad.github.io

1–10 of 110 posts

Re: REPL vs CLI: IDE wars

#2
This post could be summarized as "write as much of your project's tooling as you can in the project's main programming language and the project's main programming language should be Clojure" and I agree wholeheartedly.

Re: REPL vs CLI: IDE wars

#3

This post could be summarized as "write as much of your project's tooling as you can in the project's main programming language and the project's main programming language should be Clojure" and I agree wholeheartedly.

I think their point is bigger than that. Historically one of the major points against using Clojure to write your tooling was the slow startup times which are just painful from the CLI. It looks like the clj-exec idea linked to in the article is the secret sauce that makes moving to writing your tooling in Clojure a workable idea, since now you have a unified calling convention for both calling tooling from the REPL during development but also activating your tooling from the CLI in some CI or build pipeline where the massive Clojure startup times don't matter.

This article comes at a perfect time, we're just starting a new Clojure project and were looking into how to automate tooling since we'd been burned by Clojure startup times before. Looks like clj-exec means we can now unify our work on Clojure.

Re: REPL vs CLI: IDE wars

#4
I think you might be missing the main "aha!" of clojure REPLs vs REPLs in non-homoiconic languages: you can very easily execute small parts of the program you're editing without re-typing the code.

In emacs, for instance, you often use `eval-last-sexp`, by default bound to C-x C-e. This lets you move your cursor to a particular point in the file, often deep in a function, and get the results of just the form(s) you're pointing at.

This is a superpower! It lets you test small pieces of your code without writing any test harnesses or scaffolding. Try it with an editor that embeds the repl and has these commands, and you'll never want to develop any other way.

It does cause you to want to structure your code in 'repl-friendly' ways, so that you can, say, restart your main server or reset your state without restarting the whole process.

Re: REPL vs CLI: IDE wars

#5
post #4

I think you might be missing the main "aha!" of clojure REPLs vs REPLs in non-homoiconic languages: you can very easily execute small parts of the program you're editing without re-typing the code. In emacs, for instance, you often use `eval-last-sexp`, by default bound to C-x C-e. This lets you move your cursor to a particular point in the file, often deep in a function, and get the results of just the form(s) you'r…

When you evaluate a form deep in a function, how do you handle variables that are defined "outside"? How can you evaluate such expressions?

Re: REPL vs CLI: IDE wars

#6
Some Clojure frameworks and libs do provide REPL support for things that we would otherwise expect to be CLIs, such as running migrations, (re-)starting services and so on.

The startup time criticism is valid, but in context of development you typically don’t restart it except you pull in deps (very rare) or something terrible happens (rare).

Then, there is also borkdude/babashka which is a Clojure powered scripting tool with fast startup times due to GraalVM.

Re: REPL vs CLI: IDE wars

#7
post #5
post #4

I think you might be missing the main "aha!" of clojure REPLs vs REPLs in non-homoiconic languages: you can very easily execute small parts of the program you're editing without re-typing the code. In emacs, for instance, you often use `eval-last-sexp`, by default bound to C-x C-e. This lets you move your cursor to a particular point in the file, often deep in a function, and get the results of just the form(s) you'r…

When you evaluate a form deep in a function, how do you handle variables that are defined "outside"? How can you evaluate such expressions?

Cider (the clojure plugin for emacs) has a variant that prompts you for the the values for those variables.

Re: REPL vs CLI: IDE wars

#8
post #5
post #4

I think you might be missing the main "aha!" of clojure REPLs vs REPLs in non-homoiconic languages: you can very easily execute small parts of the program you're editing without re-typing the code. In emacs, for instance, you often use `eval-last-sexp`, by default bound to C-x C-e. This lets you move your cursor to a particular point in the file, often deep in a function, and get the results of just the form(s) you'r…

When you evaluate a form deep in a function, how do you handle variables that are defined "outside"? How can you evaluate such expressions?

You can essentially give values to global variables with same name as those outside variables.

Re: REPL vs CLI: IDE wars

#9
post #7
post #5

Earlier quoted context omitted.

When you evaluate a form deep in a function, how do you handle variables that are defined "outside"? How can you evaluate such expressions?

Cider (the clojure plugin for emacs) has a variant that prompts you for the the values for those variables.

Oh nice. That's one place where Clojure beats Common Lisp then..

Re: REPL vs CLI: IDE wars

#10
post #5
post #4

I think you might be missing the main "aha!" of clojure REPLs vs REPLs in non-homoiconic languages: you can very easily execute small parts of the program you're editing without re-typing the code. In emacs, for instance, you often use `eval-last-sexp`, by default bound to C-x C-e. This lets you move your cursor to a particular point in the file, often deep in a function, and get the results of just the form(s) you'r…

When you evaluate a form deep in a function, how do you handle variables that are defined "outside"? How can you evaluate such expressions?

The repl maintains an environment.
Post reply on HN