Live data from Hacker News

What makes a good REPL?

vvvvalvalval.github.io

111–120 of 177 posts

Re: What makes a good REPL?

#111
post #62

I am not convinced that immutability matters; this seems like a bias. After all the original REPL, and the name itself, was in Lisp (note that the first Lisp implementations were not interactive, but it was the first interactive language) and Lisp doesn't have immutable data structures. (READ, EVAL, and PRINT are all old Lisp primitives, and the REPL was literally implemented with them. There's also a complex macro c…

> Lisp doesn't have immutable data structures

Racket does have immutable data structures and Dr. Racket has a good REPL IMHO.

http://beautifulracket.com/explainer/data-structures.html

Re: What makes a good REPL?

#112
Take a look at Smalltalk's environment and take a look a t Common Lisp's REPL. They have all the features that make for a good 'REPL'.

(As noted before, REPL is a Lisp term that stands for:

read - from keyboard input, parse the input string into the syntactic structure of the language

eval - eval the expression, this includes binding variables or defining new functions, also re-defining functions, even if such function is currently under execution on the running program.

print - print the result of the evaluation (in Lisp all expressions evaluate to something, even if this 'something' is NIL).

loop - go to 'read')

Re: What makes a good REPL?

#114

Take a look at Smalltalk's environment and take a look a t Common Lisp's REPL. They have all the features that make for a good 'REPL'. (As noted before, REPL is a Lisp term that stands for: read - from keyboard input, parse the input string into the syntactic structure of the language eval - eval the expression, this includes binding variables or defining new functions, also re-defining functions, even if such functi…

> in Lisp all expressions evaluate to something

Minor nitpick, but note that if you define:

    (defun foo () (values))
Then (foo) does not return a value and accordingly, the REPL prints nothing. But in a context where you need a value, that value would be NIL: if A evaluates to 3, then after (setf a (foo)) it will evaluate to NIL.

Re: What makes a good REPL?

#115

Earlier quoted context omitted.

You sir, seem to be hell-bent against REPLs :P I agree with your point that IDEs are getting better but REPLs are getting better too, why should they be relegated to be mere artifacts of the past. Your java REPL will mostly have autocomplete, give it a chance, it really might turnout to be fun :P And typing python in a REPL is fun for me, but fun is subjective, no point arguing about it :)

I'm not against REPLs I just think they have been around since early Lisp and there are vast improvements that can be made. I use REPLs all the time... Bash is basically a REPL :) The reason I think Java REPL would be awful is not because I dislike REPLs but because Java is really painful for that kind of mutable command line like development. Like just making a damn struct like object is absolutely painful and Java…

I have to agree about Java, but hundreds of thousands of people seem to be happy using Python REPL, even if just to discover an API. At least it _does_ have a literal syntax for things like maps.

Re: What makes a good REPL?

#116

There's a lot of excitement about compiled languages lately, and many seem to wonder if interpreted languages are dying. Unfortunately I don't see the value of a good REPL brought up in those conversations very often.

Anything can have a REPL - I did one for C++ called UnderC. Unfortunately, a technological dead end and some of the worst Bison on the planet. But it was surprisingly pleasant to use C++ in a interactive way and I wrote a C++ book working from the idea that people can learn to program better in such a conversational context. Required some interesting flexibility in the usual grammar.

Re: What makes a good REPL?

#118

Earlier quoted context omitted.

You sir, seem to be hell-bent against REPLs :P I agree with your point that IDEs are getting better but REPLs are getting better too, why should they be relegated to be mere artifacts of the past. Your java REPL will mostly have autocomplete, give it a chance, it really might turnout to be fun :P And typing python in a REPL is fun for me, but fun is subjective, no point arguing about it :)

I'm not against REPLs I just think they have been around since early Lisp and there are vast improvements that can be made. I use REPLs all the time... Bash is basically a REPL :) The reason I think Java REPL would be awful is not because I dislike REPLs but because Java is really painful for that kind of mutable command line like development. Like just making a damn struct like object is absolutely painful and Java…

Fair enough, I think I am having difficulty in understanding your views because firstly I have never worked with Java, closest language I have worked with is C# and I don't particularly dislike its REPL, its nothing to write home about but I don't particularly hate it either.

Secondly the image we two have in mind of a REPL seems to be different. When I am thinking about a REPL the image I have in mind is of Jupyter Notebook and Clojure, Elixir, Idris, Haskell REPLs in Emacs. The image you have in mind seems to be a basic console, so having spent my day working in a Jupyter Notebook I sit here thinking what you mean by Python's significant whitespace being an issue(Haskell and Idris have significant whitespace too). But now I do understand your views :)

P.S. I didn't get your point about python having nominal types, duck typing seems closer to structural typing to me and mypy seems to support both, but maybe I misunderstood you. Thanks for the thought provoking discussion though :)

Re: What makes a good REPL?

#119
post #82

Saving state between runs. R has surpassed Python for me just for that feature, for interactive exploration.

I've never found a case where I've wanted to retain state between R sessions (I think doing so can be an anti-pattern).

But... that image saving feature is very much like that of Common Lisp. Given Ross Ihaka's then-and-now fondness for CL, I'd be shocked if this feature weren't very much intentionally patterned off that. The original implementation of R was on top of a Scheme runtime, but I don't know if images were (then) a feature.

Re: What makes a good REPL?

#120
post #96
post #71

Earlier quoted context omitted.

That is partially what I was referring to. The other part, which might not be visible on that video is the integration of debugger into the REPL, and the ability to redo a piece of code after breaking into the debugger and fixing it. So you can do something like, REPL => error (ask to start debugger) => track down and fix error => restart error expression => finish the execution of the original REPL expression with t…

SLIME doesn't give you this?

I don't know, back when I cared about Lisp development on Emacs, SLIME wasn't a thing, as you might understand from my XEmacs reference.
Post reply on HN