Live data from Hacker News

REPL vs CLI: IDE wars

vlaaad.github.io

31–40 of 110 posts

Re: REPL vs CLI: IDE wars

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

Which function is that? I couldn't find it in the docs

Re: REPL vs CLI: IDE wars

#32

Earlier quoted context omitted.

Homoiconicity isn't required for that, all you need is to be able to map between source and AST enough to identify expression boundaries. Plenty of development environments for non-homoiconic languages provide the ability to evaluate a selected expression (not just the last one) in a linked REPL on demand. I love the Lisp family, but I don't know why its advocates often sound like they haven't seen a dev environment…

Indeed; I do this every day with Vim and its term command, with Julia, Python, bash, Elixir—it works with any language with a REPL of any kind.

I am not familiar with how Julia and Elixir work, but form my experience Python’s REPL is not the same at all as REPL in Clojure or other lisps.

In Clojure, you literally built your program in memory while you’re writing the source code file, updating the memory representation of your running program part-by-part without ever stopping it.

This experience is absolutely magical, and it’s very hard to go back to edit-compile-run loop in other languages after that. It is completely different from “my language has a REPL and I can execute parts of code in it”.

Re: REPL vs CLI: IDE wars

#33
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?

I suspect you are right. Rebinding an inner function inside another function that contains variables probably will not work. But you could still alter and rebind the entire thing. And that is still flexible; you can still change a running program on the fly with only that ability. And you can always reference objects at the top level.

Re: REPL vs CLI: IDE wars

#34
> Don’t forget the set -euo pipefail at the beginning of your script. What does -euo means? I don’t know, I copy-pasted it and man set said there is no manual entry for set.

Use "man bash" to find the list of built-in commands. Scroll way down, or search for "SHELL BUILTIN COMMANDS".

The "e" command-line switch to the set command tells the script to exit immediately if there is a non-zero return value. The "u" switch tells the shell to treat unset variables as errors when performing parameter expansion. The "o" switch enables the following option (in this case "pipefail"). "pipefail" tells the script to return the value of the rightmost command that returned with a non-zero value in a pipeline. This is all paraphrased, the details are in the man page.

Re: REPL vs CLI: IDE wars

#35
post #19
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…

This is the draw for Jupyter Notebooks as well. Execute code blocks. I remember when I learned this in Matlab. REPL are super nice for this! I've had a hard time in Java, Fortran, etc. in determining the right development patterns that are used in this space to be productive.

Step1: Write a test.

Step2, IDE: Right click + Run.

Step2, CLI: $ run

Bonus: The test is now part of your automated test suite, and will be ran many times to ensure things don't break.

Re: REPL vs CLI: IDE wars

#36

> Don’t forget the set -euo pipefail at the beginning of your script. What does -euo means? I don’t know, I copy-pasted it and man set said there is no manual entry for set. Use "man bash" to find the list of built-in commands. Scroll way down, or search for "SHELL BUILTIN COMMANDS". The "e" command-line switch to the set command tells the script to exit immediately if there is a non-zero return value. The "u" switch…

It's kinda nonsense that `man set` doesn't provide that information. But it's kinda nonsense that those flags aren't the default, anyway.

Re: REPL vs CLI: IDE wars

#37
post #16
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?

Cursive has a repl powered debugger just put your breakpoint there use the repl to trigger the call then use intellji's debugger to step through If you want to run expressions in context just use the expression editor like a normal repl Something I haven't tried yet is redefining functions at debug time can't see why it wouldn't work though

Smalltalk famously let you code inside the debugger. You can run code with methods that don't exist yet and add them in the debugger when it notices they are missing.

Re: REPL vs CLI: IDE wars

#38

Earlier quoted context omitted.

Homoiconicity isn't required for that, all you need is to be able to map between source and AST enough to identify expression boundaries. Plenty of development environments for non-homoiconic languages provide the ability to evaluate a selected expression (not just the last one) in a linked REPL on demand. I love the Lisp family, but I don't know why its advocates often sound like they haven't seen a dev environment…

Homoiconicity is an ill-defined concept. If you take every subjective feature from it, all it implies is that you are able to cut your code into well defined AST structures (what all languages have, but for some it's easier than for others). So, yeah, anything people do with Lisp could be done for any other language, it only requires more complex tooling. How much more complexity depending on the language, and it var…

It's a well-defined concept in theory but in practice it is not:

https://www.expressionsofchange.org/dont-say-homoiconic/

https://news.ycombinator.com/item?id=20657798

Re: REPL vs CLI: IDE wars

#39

Earlier quoted context omitted.

Indeed; I do this every day with Vim and its term command, with Julia, Python, bash, Elixir—it works with any language with a REPL of any kind.

I am not familiar with how Julia and Elixir work, but form my experience Python’s REPL is not the same at all as REPL in Clojure or other lisps. In Clojure, you literally built your program in memory while you’re writing the source code file, updating the memory representation of your running program part-by-part without ever stopping it. This experience is absolutely magical, and it’s very hard to go back to edit-co…

No, Julia and Elixir are the same as Python in that regard (Python is more annoying because of the indentation problem). I was just talking about interactive evaluation of expressions selected in the editor. Although I’ve messed with Clojure a bit, I admit I don’t fully appreciate what you’re describing. I’m a little afraid to find out, frankly, because it sounds seductive.
Post reply on HN