Live data from Hacker News

What makes a good REPL?

vvvvalvalval.github.io

31–40 of 177 posts

Re: What makes a good REPL?

#31

Matlab has a nice sort-of-repl feature which I miss in every other language: you can separate the code in a file into several blocks and then execute the current block (the one with which contained the cursor) with ctrl+enter. With this feature you still have the full text editing capabilities but you also have a flexibility you get from a repl.

I guess Mathematica has the most advanced interface in that respect. That's what inspired all the other repls like Jupyter.

Re: What makes a good REPL?

#32

Matlab has a nice sort-of-repl feature which I miss in every other language: you can separate the code in a file into several blocks and then execute the current block (the one with which contained the cursor) with ctrl+enter. With this feature you still have the full text editing capabilities but you also have a flexibility you get from a repl.

Most Lisp modes for Emacs have an eval-sexpr-at-point command which allows you to send the current sexpr to the REPL. This is in SLIME for CL but even the most basic Scheme mode has it as well.

Re: What makes a good REPL?

#33

Matlab has a nice sort-of-repl feature which I miss in every other language: you can separate the code in a file into several blocks and then execute the current block (the one with which contained the cursor) with ctrl+enter. With this feature you still have the full text editing capabilities but you also have a flexibility you get from a repl.

Jupyter[1] lifted this feature from Matlab & made it work with any kernel.

[1]: http://jupyter-notebook.readthedocs.io/en/latest/examples/No...

Re: What makes a good REPL?

#34

I would also add hot loading, aka the ability to change your code and get to the same point in the execution of the code.

Hot loading only implies the former (change code of a running app) and not the latter (automatically rerun application and return to paused point).

Hot loading is typically a deployment feature that doesn't interact with the debugger at all (it doesn't require the program to be paused). Fix and continue (from smalltalk) never put the program back into a good state after code update.

Re: What makes a good REPL?

#35

Earlier quoted context omitted.

They aren't really REPLs. A REPL isn't just a prompt that you can put code into.

REPL stands for read-eval-print loop. So yes, it is just a prompt that you can put code into that will print a result.

A 'command line interface', for example for bash, does the same. What is the difference to a REPL? Is it just another name for the same concept or are there differences? What do you think?

Re: What makes a good REPL?

#36
post #7

Earlier quoted context omitted.

I like a good interpreted language as much as the next guy, but there are REPLs for compiled languages. Pretty sure Scala has one and maybe Haskell

Haskell has one - called GHCi. By these criteria: 1) You can define new functions (and values, and types, type classes, instances, etc). You can "redefine" these things only insofar as you can shadow them. 2) I'm not sure whether they mean the ability to persist your state to disk and restore it (which GHCi lacks), the ability to refer to previous results (in GHCi, the previous result is called `it`), or just the abi…

Yes for (3)! I just plainly hate data types whose Show instances aren't just Haskell syntax. They usually try to add some pretty printing but that just ends such hurting copy-pasting from the REPL to the editor.

Re: What makes a good REPL?

#37

I think REPLs work better in languages that provide 1st class immutability support, since it's easier to set up state once, then play with functions without having to re-set up state every time you tinker.

I think REPLs work better in languages that don't provide 1st class immutability support, since it's easier to change state, then play with functions without having to re-set up state every time you tinker.

Re: What makes a good REPL?

#38
post #17

I loved this article. I am a huge proponent of development ergonomics, and clojure(script) are really fantastic in this area. Most languages have a pretty similar standard set of tooling, but the pieces that a language does exceptionally well really stand out in cases like this. I'd really love to see what languages designed specifically with ergonomics/tooling in mind look like

> I'd really love to see what languages designed specifically with ergonomics/tooling in mind look like

Warren Teitelman (and later many people at Xerox PARC) did this with BBN Lisp/Interlisp, starting with real paper teletypes through to graphical workstations.

Re: What makes a good REPL?

#40

I would also add hot loading, aka the ability to change your code and get to the same point in the execution of the code.

Hot loading only implies the former (change code of a running app) and not the latter (automatically rerun application and return to paused point). Hot loading is typically a deployment feature that doesn't interact with the debugger at all (it doesn't require the program to be paused). Fix and continue (from smalltalk) never put the program back into a good state after code update.

[deleted]
Post reply on HN