Skip to content

add :help repl command - #215

Closed
bookshelfdave wants to merge 4 commits into
masterfrom
dp_help
Closed

bookshelfdave wants to merge 4 commits into
masterfrom
dp_help

Conversation

@bookshelfdave

Copy link
Copy Markdown
Collaborator

closes #79

@byorgey byorgey left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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\

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not use the technical term "bound". Maybe something like "Show all currently loaded names and their types".

@byorgey

byorgey commented Jun 22, 2020

Copy link
Copy Markdown
Member

Happy to discuss this further via IRC or whatever if you want help fleshing out a design.

@bookshelfdave

Copy link
Copy Markdown
Collaborator Author

I like the Command idea, I'll play around with the code for a bit and see what that looks like. Thanks @byorgey!

@byorgey
byorgey deleted the dp_help branch May 27, 2021 16:34
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

Successfully merging this pull request may close these issues.

:help for disco REPL

4 participants