REPL ergonomics

Sure, I only offered that as an example. The real Python text is more descriptive:

>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit
>>> quit
Use quit() or Ctrl-D (i.e. EOF) to exit
>>> help
Type help() for interactive help, or help(object) for help about object.

If we could do the same thing, where exit or help without parens still manages to tell you what you need to do to really exit or get proper help, would you consider that an improvement?

1 Like

I prefer brew unlink python@2. I'm not sure why they link python into PATH when they are careful about other system-provided libraries.

⌃ is the system glyph for the control key, and is printed on the key. (See the Apple menu for an example in use)

^ is an ASCII substitute.

I'd personally prefer to provide and document exit/quit commands rather than assume someone using the terminal is unfamiliar with keyboard shortcuts.

They're not printed on PCs, however. We shouldn't neglect Swift on linux, and eventually, Windows.

2 Likes

It's also not printed on all Mac keyboards (both of the ones I'm looking at right now don't have it)

2 Likes

Aside from the command key, the modifier keys on Mac keyboards sold in the US use only words, not symbols.

Newer Mac keyboards in the US have symbols on Control, Option, and Command. (But we should just tell people to use :quit.)

All currently sold domestic and international keyboards (including the iPad keyboard cover) have the glyph, but the MacBook Air and some older keyboards omitted it.

It is a distraction from the topic, though. as AlexanderM brought up, if the goal is eventually to be cross-platform to non-unix-derived platforms like windows, users there expect it to be spelled out as control or abbreviated as CTRL. Since the REPL would likely be primary mechanism for initial teaching, it makes sense to try to make the help clear.

Of course, it could very well be that the mechanisms for interacting with the REPL differ per platform - I don't think CTRL+D is a thing on Windows, because the command prompt isn't an actual shell.

1 Like

Ahh, segue: if you do shell scripting you usually will learn that ^D is how you (non-fatally) close input, as it represents the EOF control character. So it winds up being the way you (non-fatally) stop all sorts of tasks involving user input, such as cat > txtfile to type out a new file.

3 Likes

Perhaps I am too cynical but I think that people who can't google their way out of the REPL have no chance of successfully writting any swift code.

1 Like

The point is not that googling is impossible, but it's also quite unnecessary. The cost of replying to exit, quit and other natural input is inexistent, so why not implement it? Cf type inference, it's not necessary but it is still helpful.

3 Likes

Hi, necroing this thread but I'm curious if the "reset the current instance of the repl" feature ever became a reality?