Repository navigation
add :help repl command - #215
bookshelfdave wants to merge 4 commits into
Conversation
Restyle add :help repl command
There was a problem hiding this comment.
A few thoughts. First, note that the commands :ann, :compile, :desugar, :parse, and :pretty are intended to be used by developers but I imagine turning them off in the version used by students. At the very least I could imagine grouping all the "student-facing" commands first and then the developer-facing commands after that, rather than just having them all alphabetized.
In order to facilitate turning off certain commands, and also to make it harder to forget to edit the help text later when we add new commands or change existing ones, I wonder about refactoring things so that the REPL is built out of a list of Command objects. Each Command object would contain information such as the name of the command, whether it is a developer-facing command, a parser, an action for carrying out the command, and help text (we could even include both a short form --- for displaying in the list of available commands --- and a long form, which could e.g. be displayed when the user types something like :help doc.
The tricky part of this is that different commands need different numbers and types of arguments, so actually including the actions to be run for each command would require some type trickery. But it would still be nice even without that --- every Command object contains its name, a parser, and help text; the parsers all return a REPLExpr, and then we just keep the handleLine function as it is now.
| \ :doc Show documentation for a function\n\ | ||
| \ :help This command, shows REPL commands\n\ | ||
| \ :load Load a file\n\ | ||
| \ :names Show all names currently bound\n\ |
There was a problem hiding this comment.
Let's not use the technical term "bound". Maybe something like "Show all currently loaded names and their types".
|
Happy to discuss this further via IRC or whatever if you want help fleshing out a design. |
|
I like the |
closes #79