racket-rash
racket-rash copied to clipboard
Allow comment with # in repl
This allows eg the readline vi mode move
For the moment I don't think I'll put #
as comment in the default rash language, and I don't think I want the repl language to diverge that much from the module language.
That said, I intend to make it easy to run alternative versions of Rash in the terminal. This is mostly planned as a feature of the line editor I intend to make. A big problem with Racket generally at the moment is that there is no good way to make a REPL for a custom #lang
. So it is easy with many languages to make a variant of a language with a modified reader, or use meta languages like #lang at-reader racket
that modify readers. But there is no way to do that with a repl. Or even an easy way to use a stock s-expression reader with different bindings at a repl. So when I write my line editor I intend to make an easy way to configure it to use arbitrary user-defined readers, bindings, etc. I'm not sure how closely this will resemble the #lang
protocol, since #lang
specifies the reader and binding set at once, and the module context (with a #%module-begin
) is different than a repl context, so I can't “just” use the #lang
protocol. (IE much of what a #lang
means may be defined by its #%module-begin
definitien, which a REPL can't use.) But it will allow for similar things.
Honestly, Racket's #lang
protocol, while super awesome, is really only geared to code in modules, and there are currently only weak ways of making a language work in a repl at all, or defining what that would mean. Racket currently provides basically no way to do any of this in Racket's command-line REPL and some limited facilities for defining what to do for DrRacket's REPL. I intend to make a nice way of specifying this info for making REPLs with my line editor. Ultimately I intend for it to be the go-to way to make arbitrary REPLs for Racket languages, where Rash will essentially be the flagship example. What this will probably look like in the end is that you can write a module that defines a REPL as a reader, a set of core bindings, and some other info like a name for the language that can be introspected by the line editor to load any language-specific configuration that the user has, or info relating to programmable completion for the language, etc.
Unrelated to this repl stuff directly, but related to running modified versions of Rash, I also am (still...) working on some parsing stuff that I intend to use to replace Rash's parser implementation (or perhaps be the parser implementation for a Rash2 or something) that will also provide much more powerful (and much easier and declarative) ways of modifying the reader layer to do what you want.