Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow comment with # in repl #83

Open
singpolyma opened this issue Apr 12, 2021 · 1 comment
Open

Allow comment with # in repl #83

singpolyma opened this issue Apr 12, 2021 · 1 comment

Comments

@singpolyma
Copy link

This allows eg the readline vi mode move # to effectively save current line to history without running it as it would in bash.

@willghatch
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants