Live data from Hacker News

What makes a good REPL?

vvvvalvalval.github.io

121–130 of 177 posts

Re: What makes a good REPL?

#121
post #15
post #9

Earlier quoted context omitted.

What do you mean with "picking them all up?"

They mean the learning curve is steep.

A "steep learning curve" actually means that the amount learnt grows rapidly over time. It's odd how this basically obvious conceptualization has had its meaning inverted in popular usage.

Re: What makes a good REPL?

#122

Earlier quoted context omitted.

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.

If you want to be literal about it then sure, it just means read-eval-print loop. But I think that's akin to saying that a functional programming language is a language that has functions in it. EDIT: To be clear, what I'm saying is that when people say 'I really love using Common Lisp because it has a REPL' they aren't saying 'I really love using Common Lisp because it has a prompt I can write raw strings of code in…

Sorry if my comment with the definition of REPL seemed "viscerally negative". I understand that a good REPL has more features that just the bare bones, but you said that programs that read an input, evaluated it, and then printed the result aren't REPLs. You should've said that they aren't good or useful REPLs.

Your argument is the equivalent of saying notepad isn't a text editor because you can't edit multiple lines at once or highlight syntax. Those are features that good text editors have, but it does not mean notepad is not a text editor.

Re: What makes a good REPL?

#123
post #120
post #96

Earlier quoted context omitted.

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.

SLIME does let you redefine functions and restart a stack frame (assuming the Lisp implementation supports that). You can even do it without using Emacs/SLIME, although that's not very convenient of course. A silly example with SBCL,

    ~ $ rlwrap sbcl --noinform
    CL-USER> (defun foobar (x y)
               (if (evenp x)
                   (/ x y)
                   (* x y)))
    
    FOOBAR
    CL-USER> (foobar 10 0)
    
    debugger invoked on a DIVISION-BY-ZERO in thread
    #:
      arithmetic error DIVISION-BY-ZERO signalled
    Operation was /, operands (10 0).
    
    Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
    
    restarts (invokable by number or by possibly-abbreviated name):
      0: [ABORT] Exit debugger, returning to top level.
    
    (SB-KERNEL::INTEGER-/-INTEGER 10 0)
    0] backtrace 3
    
    Backtrace for: #
    0: (SB-KERNEL::INTEGER-/-INTEGER 10 0)
    1: (FOOBAR 10 0)
    2: (SB-INT:SIMPLE-EVAL-IN-LEXENV (FOOBAR 10 0) #)
    
    0] down
    (FOOBAR 10 0)
    
    1] source 1
    
    (IF (EVENP X)
        (#:***HERE*** (/ X Y))
        (* X Y)) 
    1] (defun foobar (x y)
         (if (and (evenp x) (not (zerop y)))
             (/ x y)
             (* x y)))
    
    WARNING: redefining COMMON-LISP-USER::FOOBAR in DEFUN
    FOOBAR
    1] restart-frame
    
    0

Re: What makes a good REPL?

#124

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.

Mildly off-topic: automatically shadowing bindings is one of my favorite changes elixir made to erlang

Re: What makes a good REPL?

#125
post #123
post #120

Earlier quoted context omitted.

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.

SLIME does let you redefine functions and restart a stack frame (assuming the Lisp implementation supports that). You can even do it without using Emacs/SLIME, although that's not very convenient of course. A silly example with SBCL, ~ $ rlwrap sbcl --noinform CL-USER> (defun foobar (x y) (if (evenp x) (/ x y) (* x y))) FOOBAR CL-USER> (foobar 10 0) debugger invoked on a DIVISION-BY-ZERO in thread # : arithmetic erro…

Thanks for the example.

Re: What makes a good REPL?

#126
post #50
post #21

Earlier quoted context omitted.

I don't think there's anything fundamental about a compiled language that prevents it from having a REPL. (If anything, you could always have a dedicated interpreter for interactive work—"compiled" and "interpreted" are functions of the implementation , no the language .) In practice the compiled languages I've used extensively (OCaml and Haskell) do have REPLs, but ones that aren't nearly as powerful as some other l…

> If anything, you could always have a dedicated interpreter for interactive work CMUCL does that. There's an interpreter that's used for the REPL and optionally for loading files on the fly, and an optimizing AOT compiler. SBCL drops the interpreter and just runs the compiler with settings that make it reasonably fast for interactive use as I recall. Clojure, too just uses the compiler interactively and not a separa…

I wonder how do that. I'm building a language that truly will benefit for a REPL (is for database development) but also do it compiled simplified other things.

Is done on .NET/F#. I wonder how architect the thing so I can have a good repl yet compiled... but how?

Re: What makes a good REPL?

#127
post #15

Earlier quoted context omitted.

They mean the learning curve is steep.

A "steep learning curve" actually means that the amount learnt grows rapidly over time. It's odd how this basically obvious conceptualization has had its meaning inverted in popular usage.

This is one of my pet peeves, as well. Though I have moved on. Colloquially, it is clear how folks take that saying. Just transpose the chart if it helps you think about it.

That is, it may have originated with that meaning. But it is far from unique in having the general meaning shifted with use.

Re: What makes a good REPL?

#128
post #59
post #8

Earlier quoted context omitted.

Though, they are lacking the magic of a REPL in CL. Hotspot replacement in JVM languages is neat compared to the magic of redefinitions in CL. And it seems nobody ever tries hooking a REPL up to a running system anymore.

Java 9 is also bringing one.

I'm curious what makes this superior to Beanshell. Or any other style of REPL that you could do on the JVM.

Not against the idea, per se, but it seems hardly new ground. And unlikely to be nearly as powerful as a REPL in CL. (Though, again, few things are. Not sure that any are, to be honest.)

Re: What makes a good REPL?

#129
post #126
post #50

Earlier quoted context omitted.

> If anything, you could always have a dedicated interpreter for interactive work CMUCL does that. There's an interpreter that's used for the REPL and optionally for loading files on the fly, and an optimizing AOT compiler. SBCL drops the interpreter and just runs the compiler with settings that make it reasonably fast for interactive use as I recall. Clojure, too just uses the compiler interactively and not a separa…

I wonder how do that. I'm building a language that truly will benefit for a REPL (is for database development) but also do it compiled simplified other things. Is done on .NET/F#. I wonder how architect the thing so I can have a good repl yet compiled... but how?

I hope jetbrain will do something magic on repl

Re: What makes a good REPL?

#130
post #126
post #50

Earlier quoted context omitted.

> If anything, you could always have a dedicated interpreter for interactive work CMUCL does that. There's an interpreter that's used for the REPL and optionally for loading files on the fly, and an optimizing AOT compiler. SBCL drops the interpreter and just runs the compiler with settings that make it reasonably fast for interactive use as I recall. Clojure, too just uses the compiler interactively and not a separa…

I wonder how do that. I'm building a language that truly will benefit for a REPL (is for database development) but also do it compiled simplified other things. Is done on .NET/F#. I wonder how architect the thing so I can have a good repl yet compiled... but how?

Since more than a few language implementations already do things like that, I'm inclined to say that's more or less a solved problem.
Post reply on HN