develooper Front page | perl.perl6.users | Postings from July 2021

Re: REPL / Linenoise question (backslashes)

Thread Previous | Thread Next
From:
William Michels via perl6-users
Date:
July 21, 2021 16:52
Subject:
Re: REPL / Linenoise question (backslashes)
Message ID:
CAA99HCwcAa7M41mwwBr1vyC_01e5_WwOmujaH=seVq+dKc5uMw@mail.gmail.com
Dear Brian,

Thank you for your analysis! I am particularly intrigued by your
Jupyter comment:

"Note that this is not the same as the raku 'unspace' -- a backslash
followed by a newline will be replaced with a newline before the code
is executed. To create an unspace at the end of the line, you can use
two backslashes."

https://github.com/bduggan/p6-jupyter-kernel#usage-notes

Sorry for my continuing confusion, but I don't see any use-case for an
"unspace" at the end of a line in the Raku REPL, or the Jupyter
kernel. Would this be useful for something like POD documentation? So
you can enter text, enter an "unspace"-followed-by-newline, and have
the REPL/Jupyter_kernel know not to break the text into chunks
(linewise)? And if you need to create an "unspace" *within* a line of
code in the Jupyter kernel, does it also have to be two consecutive
backslashes?

Two final thoughts/comments:

1. I'm using Linenoise instead of Readline on my (older) MacOS system,
in part because there were issues hooking into the MacOS Readline
library. Does one (either Linenoise or Readline) handle end-of-line
backslashes better?

2. I put up some REPL code from R, Python and Ruby (irb). They seem to
fall into two categories: those that accept pasted multi-line code but
don't tolerate backslashes (R), and those that don't accept pasted
multi-line code but do tolerate backslashes (Python, Ruby).
Personally, I like R's handling better (here I'm assuming different
OSes can handle copy/pasting equally well).

What say everyone else?

Best Regards, Bill.

PS I should note that the R-Foundation releases a GUI for each
platform flavor that they release. Also there's a Vim-R plugin for
interconnectivity, for those into that sort of thing:

https://www.r-project.org/
https://github.com/jalvesaq/R-Vim-runtime




On Tue, Jul 20, 2021 at 3:21 AM Brian Duggan <bduggan@matatu.org> wrote:
>
> On Monday, July 19, William Michels via perl6-users wrote:
> > I don't see how the Raku REPL knows how to cycle from taking input at its
> > prompt and moving to the read/evaluate step.
>
> This currently happens when the parser throws one of these exceptions:
>
>   X::Syntax::Missing
>   X::Comp::FailGoal
>
>   see https://github.com/rakudo/rakudo/blob/master/src/core.c/REPL.pm6#L281
>
> I think this is less than awesome in some cases, which is why in
> the Jupyter command line I explicitly supported using a backslash
> to indicate that there is more input --
>
>   https://github.com/bduggan/p6-jupyter-kernel#usage-notes
>
> Brian
>

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About