News for hackers. Stuff that matters.
Re:What makes a good REPL? by yoodenvranx on Sunday August 27, 2017 @07:31PM (#15113420)
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.
Re:What makes a good REPL? by suraj on Sunday August 27, 2017 @09:06PM (#15113786)
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? by pedrosorio on Monday August 28, 2017 @01:22AM (#15114565)
I believe it was inspired by Mathematica which created the concept of notebooks with cells backed by a kernel in 1988:

https://en.wikipedia.org/wiki/Wolfram_Mathematica#The_Notebo...

Re:What makes a good REPL? by bitwize on Sunday August 27, 2017 @09:06PM (#15113784)
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? by _pmf_ on Monday August 28, 2017 @05:49AM (#15115487)
Clojure's Emacs REPL also has this; it's strange that the article does not mention it, but talks about copying back and forth between REPL and suorce, which I consider a antipattern and really ugly workflow.
Re:What makes a good REPL? by jasonm23 on Monday August 28, 2017 @07:20PM (#15120975)
Emacs can do this with Ruby, Python... Hell, you can get it to eval buffer, region, line with anything that'll accept input and return a useful output.

The ease at which one can get any language (or I/O machine) to play along with this workflow in Emacs is astonishing.

Re:What makes a good REPL? by abhirag on Sunday August 27, 2017 @07:52PM (#15113500)
You seem to be using SublimeText, check out SublimeREPL extension[https://github.com/wuub/SublimeREPL/blob/master/README.md]. Once setup you'll be able to evaluate code blocks in a running REPL :) Also, Emacs modes of most languages with REPLs will have this functionality inbuilt.
Re:What makes a good REPL? by blt on Sunday August 27, 2017 @08:23PM (#15113600)
Matlab's REPL experience is great. It satisfies almost all of the "what makes a good REPL" and "what makes a programming language REPL-friendly" criteria in the article. Having a full featured plotting library available to inspect intermediate values when debugging is amazing.
Re:What makes a good REPL? by mclehman on Sunday August 27, 2017 @07:33PM (#15113427)
Lisp + Emacs + SLIME: miss no longer.

Picking them all up is a tall order though.

Re:What makes a good REPL? by pjmlp on Monday August 28, 2017 @02:19AM (#15114735)
Emacs suffers from not being like Lisp machines REPL, meaning lacking graphical display on buffers.

If I remember correctly, XEmacs used to support it (which was my favorite fork), but it seems to have faded away.

For example, try to achieve this demo on Emacs.

https://www.youtube.com/watch?v=o4-YnLpLgtk

Re:What makes a good REPL? by abhirag on Monday August 28, 2017 @03:09AM (#15114907)
I have never used a Lisp Machine so forgive my naivety but I saw the demo and you seem to be referring to the ability of displaying images inline in a buffer. Emacs can definitely do that, I have used Emacs IPython Notebook[1] which is a REPL supporting this. I could fire up a jupyter notebook and use pillow[2] to recreate the image manipulation part of the demo.

[1] -- (https://github.com/millejoh/emacs-ipython-notebook/blob/mast...) [2] -- (https://python-pillow.org/)

Re:What makes a good REPL? by pjmlp on Monday August 28, 2017 @04:01AM (#15115107)
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 the respective result.

Re:What makes a good REPL? by abhirag on Monday August 28, 2017 @05:15AM (#15115356)
The only debugging experience I find enjoyable in Emacs is debugging Clojure using cider[1] and I think it comes close to what you are describing but I think you might already be aware of that :)

[1] -- (https://github.com/clojure-emacs/cider/blob/master/doc/debug...)

Re:What makes a good REPL? by bitwize on Monday August 28, 2017 @07:01AM (#15115723)
SLIME doesn't give you this?
Re:What makes a good REPL? by pjmlp on Monday August 28, 2017 @10:19AM (#15116679)
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.
Re:What makes a good REPL? by juki on Monday August 28, 2017 @10:57AM (#15116907)
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
    #<THREAD "main thread" RUNNING {1001BB64C3}>:
      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: #<SB-THREAD:THREAD "main thread" RUNNING {1001BB64C3}>
    0: (SB-KERNEL::INTEGER-/-INTEGER 10 0)
    1: (FOOBAR 10 0)
    2: (SB-INT:SIMPLE-EVAL-IN-LEXENV (FOOBAR 10 0) #<NULL-LEXENV>)
    
    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? by pjmlp on Monday August 28, 2017 @11:36AM (#15117242)
Thanks for the example.
Re:What makes a good REPL? by taeric on Sunday August 27, 2017 @07:46PM (#15113480)
What do you mean with "picking them all up?"
Re:What makes a good REPL? by _mhr_ on Sunday August 27, 2017 @08:03PM (#15113549)
They mean the learning curve is steep.
Re:What makes a good REPL? by pklausler on Monday August 28, 2017 @10:20AM (#15116683)
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? by taeric on Monday August 28, 2017 @12:12PM (#15117615)
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? by taeric on Sunday August 27, 2017 @09:57PM (#15113957)
Ah, fair enough. The nice thing is most repl's have the same bindings as each other. So, some basic drills can get you up to speed.
Re:What makes a good REPL? by jhgb on Sunday August 27, 2017 @08:13PM (#15113570)
Lisp buffers? Smalltalk workspaces? Is this capability any different from those?
Re:What makes a good REPL? by auggierose on Sunday August 27, 2017 @08:57PM (#15113739)
I guess Mathematica has the most advanced interface in that respect. That's what inspired all the other repls like Jupyter.