Support typing "exit" or "quit" means exit from REPL. #19021
Description
Activity
exitandquitcould be variable names so we have.exit. we could do what python does and show a warning when those keywords are asked for without being assigned- addedquestionIssues asking questions about Node.js.Issues asking questions about Node.js.replIssues and PRs related to the REPL subsystem.Issues and PRs related to the REPL subsystem.
on Feb 27, 2018 we could do what python does and show a warning when those keywords are asked for without being assigned
that's better, or you could forbid people to define global variable named "quit" or "exit" only in REPL just like what ipython already did and that is considered user friendly.
- addedfeature requestIssues requesting new Node.js features.Issues requesting new Node.js features.and removedquestionIssues asking questions about Node.js.Issues asking questions about Node.js.
on Mar 5, 2018 - changed the title
[-]Everyone in the world knows that typing "exit" or "quit" means exit from REPL.[/-][+]Support typing "exit" or "quit" means exit from REPL.[/+]on Mar 13, 2018 I've modified the title to be a little bit more friendly.
Reacted by mary marchiniWould you all be opposed to prompting for clarification? The repl makes you type
CMD-Ctwice to exit.You could do something like:
> exit Did you mean '.exit' [Y/n]?
It could default to YES, so, if they simply press return, they’ll exit. If they say NO, it will proceed to run as if exit is a reference.
Benefits:
- No addition of restricted words (quit or exit may be a function that the user defined)
- No conditional logic based on what’s defined in the scope (which may cause confusion)
- A noninvasive reminder of the current way to exit the repl
Reacted by Gibson Fahnestock, Ben Halverson and mary marchini- added a commit that references this issue
on May 18, 2018 - added a commit that references this issue
on May 18, 2018 - added a commit that references this issue
on May 22, 2018

And why nodejs doesn't know that?