Live data from Hacker News

What makes a good REPL?

vvvvalvalval.github.io

101–110 of 177 posts

Re: What makes a good REPL?

#101
post #98
post #95

Earlier quoted context omitted.

The interactive development workflow in Idris is best described as type driven development and the focus seems to be on making the REPL an interface where an intelligent dialog can happen in between the programmer and the compiler, with the compiler trying to nudge you in the right direction. It is kinda fun, you should definitely check it out[1]. And regarding your point about the modern IDE workflow, I personally t…

I have been meaning to look at Idris for so long! Thanks for the inspiration to move that higher up the queue :)

Definitely start with the book I mentioned, it is by Edwin Brady, he leads the development of Idris. I am reading it right now and it is an enjoyable read :)

Re: What makes a good REPL?

#102
post #91

Earlier quoted context omitted.

I'd even say immutability can be a disadvantage. I normally only use a repl when I don't know what I'm doing. My normal process with a repl in an immutable language goes like this: 1. Assign something to a name 2. Realise that was wrong, try again. 3. Get told no. Remember to tell the repl to forget the wrong one and do it again (or choose a new name). 4. Try to assign something else to another name (probably 'foo')…

I think there may be some confusion here, immutability is about the stability of values (e.g. I have a string, list, map etc and I want to pass it to others, view its value, make changes without affecting the original value). Immutability is not the same as rebinding a name (in clojure at least) e.g. the following is perfectly valid (global and local binding of the same name repeatedly) (def a 1) (def a 2) (def a 3)…

Some languages have immutable bindings too, where you only shadow previous bindings.

Re: What makes a good REPL?

#103

> Data literals. That is, the values manipulated in the programs have a textual representation which is both readable for humans and executable as code. --8 This is not a dig at Kotlin/Java/Whoever but it bugs me (coming from Ruby) no end when regexen don't get to have a regex literal syntax and a match operator. I was going through the Kotlin language docs last night and its such a concise language with well thought…

> I'd also like to be able to specify my own braces to construct my own type as a shorthand, that'd be great DSL

That's the purpose of readtables in Common Lisp, defining custom readers for converting external representation to internal ones.

Re: What makes a good REPL?

#104
post #37

Earlier quoted context omitted.

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.

You could just store your modified state to new variables though

In a live-coding session, how does the existing, running code knows that it should look at the new variables instead of the old ones?

Re: What makes a good REPL?

#105
post #102

Earlier quoted context omitted.

I think there may be some confusion here, immutability is about the stability of values (e.g. I have a string, list, map etc and I want to pass it to others, view its value, make changes without affecting the original value). Immutability is not the same as rebinding a name (in clojure at least) e.g. the following is perfectly valid (global and local binding of the same name repeatedly) (def a 1) (def a 2) (def a 3)…

Some languages have immutable bindings too, where you only shadow previous bindings.

If you can shadow previous bindings then that would also cause no problem for repl re-usage, unless the shadowing syntax is different to the binding syntax.

Either way, unrelated to the point in the article about the advantage of immutable values for repl, not immutable bindings.

I would certainly agree that truly immutable bindings would be at best quite a stumbling block for repls, but so far no one was advocating for them as a good repl feature.

Re: What makes a good REPL?

#106
post #99

Earlier quoted context omitted.

Java is getting a REPL though. I believe it is part of Java 9 ;).

However to the author's point I believe some languages are inherently superior for REPLs particularly if they have powerful literal syntax. Java is not a fun language to type expressions in and IMO neither is Python albeit for completely different reason. I can elaborate more if you like but I think most will agree.. Java will be a pain to type in a REPL.

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 :)

Re: What makes a good REPL?

#107
post #75
post #47

With fast compiling languages a unit test is not for off from being a REPL. In Java I use JUnit as a REPL. Actually I prefer unit tests over a REPL the same reason I prefer bash scripts over one liners or SQL scripts instead of typing into the interpreter... I don't like the ephemeral nature of REPLs. Also with true REPLs unlike the debug unit test approach I mention with Java you really need the language to be dynam…

The thing to realise is that, at least is my experience, REPL based development doesn't mean your are actually typing code into the REPL. Instead, you develop code in a file, but constantly evaluate code as you go along. When I work on a clojure project, I very rarely open the actual REPL, but I am constantly evaluating code and experimenting with different implementations of functions. Then, when I'm happy with the…

Instead, you develop code in a file, but constantly evaluate code as you go along.

Half the time I find I go the other way. I develop in jupiter, and copy the function to a file once I get it working.

Re: What makes a good REPL?

#108
post #91

Earlier quoted context omitted.

I'd even say immutability can be a disadvantage. I normally only use a repl when I don't know what I'm doing. My normal process with a repl in an immutable language goes like this: 1. Assign something to a name 2. Realise that was wrong, try again. 3. Get told no. Remember to tell the repl to forget the wrong one and do it again (or choose a new name). 4. Try to assign something else to another name (probably 'foo')…

I think there may be some confusion here, immutability is about the stability of values (e.g. I have a string, list, map etc and I want to pass it to others, view its value, make changes without affecting the original value). Immutability is not the same as rebinding a name (in clojure at least) e.g. the following is perfectly valid (global and local binding of the same name repeatedly) (def a 1) (def a 2) (def a 3)…

I see. When I see "immutable", I think of Prolog and Erlang (e.g. once X is 6, X can't be matched to 5 in the same scope) rather than languages that simply prefer byval over byref.

Re: What makes a good REPL?

#109
post #99

Earlier quoted context omitted.

However to the author's point I believe some languages are inherently superior for REPLs particularly if they have powerful literal syntax. Java is not a fun language to type expressions in and IMO neither is Python albeit for completely different reason. I can elaborate more if you like but I think most will agree.. Java will be a pain to type in a REPL.

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 does not have structural types (ignoring FunctionalInterfaces which isn't really structure types).

Python REPL is painful because of required indentation and again because Python is similar to Java and prefers nominal types.

I'm not against Python or Java but I don't think the language design of those languages really works well for REPL compared to say Lisp, OCaml, Haskell, or even Scala and Smalltalk.

Re: What makes a good REPL?

#110

Earlier quoted context omitted.

I think there may be some confusion here, immutability is about the stability of values (e.g. I have a string, list, map etc and I want to pass it to others, view its value, make changes without affecting the original value). Immutability is not the same as rebinding a name (in clojure at least) e.g. the following is perfectly valid (global and local binding of the same name repeatedly) (def a 1) (def a 2) (def a 3)…

I see. When I see "immutable", I think of Prolog and Erlang (e.g. once X is 6, X can't be matched to 5 in the same scope) rather than languages that simply prefer byval over byref.

well clojure does pass by reference, but the reference is to something that cannot be changed (i.e. a persistent data structure)
Post reply on HN