factor / factor

Factor programming language

Home Page:https://factorcode.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add `system` to standard word search list such that calling `exit`/`(exit)` does not first issue an error

nomennescio opened this issue · comments

Exiting the (UI) listener is a basic operation. Add system to the standard word search order, so the user can exit without getting annoying error messages.

Ctrl-D doesn't close the UI. Ctrl+Q or Alt+F4 may work.

Does the user think exit would close the whole Factor process, or just the UI Listener window that its being typed into?

Does the user think exit would close the whole Factor process, or just the UI Listener window that its being typed into?

I don't know of course, but having used quite some interpreters, typing a keyword to close everything is pretty standard.
Personally I find it annoying to switch to mouse and click multiple windows (Browser, Walker, tons of Inspectors) to close everything. Keyboard shortcuts like Alt+F4 don't close all other Windows. CTRL-Q does indeed close other Windows.

CTRL-Q is bound to com-exit, which calls 0 exit. So indeed a valid shortcut. It is however not really documented; the documentation on https://docs.factorcode.org/content/article-ui-shortcuts.html describes a keybinding:
⌘Q to "Exit | com-exit", with a , not CTRL

I still think exit is the commonly typed keyword for people who have little clue (the other one is typically quit, but that one is much more overloaded in Factor) and want to exit a shell or interpreter. I want to prevent the VIM-syndrome where exiting it is so uncommon it has become its own meme.

Searching through the vocabs, the only other vocab that defines exit is cuda.ptx, where it is a tuple.

Looking at the command-line listener, return is required to "exit" it (https://docs.factorcode.org/content/article-listener.html), which is a bit uncommon, but then again, it's not a common way to run Factor, so that is less of a concern.

Maybe the more elegant solution is to introduce an alias in the UI Listener for com-exit; it won't affect existing code, doesn't introduce all system words in the global vocab search space, and is limited to the UI Listener only, and only clashes if the user explicitly loads system in scratchpad and defines words with that.

I'll make a pull request out of that, and then you can comment on that, and if you agree accept it, or reject it. Then I'll close this issue.

Hmm, just adding the alias to ui.tools.factor still does not make it immediately available to the standard search path. OK, I'll think of something else.

What’s wrong with Ctrl-D for EOF?Works in command line and UI listeners?

As noted CTRL-D does not work on Windows to exit Factor (see above)
And I want a command to help people who expect a command to exit Factor, not a key-combo

But they likely don't expect it to exit Factor, they likely expect it to exit one of the listener windows, no?

How do you type an EOF on windows?

How do you type an EOF on windows?

CTRL-Z if you're on cmd.com, but that's never used to close a console. On Cygwin and MSys, it's CTRL-D.

But they likely don't expect it to exit Factor, they likely expect it to exit one of the listener windows, no?

As I said, I find that hard to predict; typically people start an interpreter from the commandline (factor.exe) with a keyboard, then also expect to exit using a keyboard command. People who start it by double-clicking on icon with the mouse, expect it to close with the mouse. Both scenarios happen. People using universally an EOF char to close things is not very common outside Unix.

With the solution for #3004 , CTRL-Q closes the Factor Windows and properly handles calls to be handled at window closure (ungraft*). Given that exit bypasses all Windows handlers, for the UI I don't consider exit the preferred way to exit the UI anymore.

Therefore the word to properly end the listener is com-exit

Maybe we can have an easier to remember ALIAS: for that?

I propose quit for that, it's used only in a few other vocabs to quit a special application, so that will hardly lead to troublesome clashes.

Reverting, ui.tools isn't even in the default search path.

if you need this you can make an alias in your factor-rc / factor-boot-rc.

Ctrl-D works on windows