[racket-dev] Line editing in the default REPL

From: Eli Barzilay (eli at barzilay.org)
Date: Sat Dec 13 20:57:06 EST 2014

On Sat, Dec 13, 2014 at 7:00 PM, Leif Andersen <leif at leifandersen.net> wrote:
> Okay, here's another idea.
> I have parametrized the readline collection over the readline/edit/etc.
> library. You can do:
>> (require editline)
> For the editline equivalent.
> It also falls back to no line editing (rather than throwing an
> exception), if the library is not there.
> The source is here: https://github.com/LeifAndersen/readline

(For reference: it's in the editline branch...)

> I'm thinking we could distribute the editline collection with Racket
> (treating libedit the same way we currently treat other native
> packages such as libcairo). And then we can make xrepl default.
> Would this be doable?

I looked at the code a little, but I couldn't find the place that does
the fallback part.  (You're defining a `libreadline-path' which AFAICS
isn't used.)  But it looks like you're using the same interface for both
editline and readline -- right?  If so, then I think that it's better to
just keep the current setup, and do this:

    (define libreadline (ffi-lib "libreadline" '("5" "6" "4" "")
                                 #:fail (lambda () (ffi-lib "libedit" ...))))

And since that addresses an API that is shared for the two, then it's
not code that should be linked only with readline, which means that it's
fine to it by default...?

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the dev mailing list.