UI review: jshell commands
Robert Field
robert.field at oracle.com
Mon Jun 29 18:40:29 UTC 2015
> On Jun 29, 2015, at 10:43 AM, Brian Goetz <brian.goetz at oracle.com> wrote:
>
> Going over the / commands in jshell.
>
> 1. Are we sure /help is complete? I have not been able to determine it is not, but we should review that it is (ideally, deriving the /help text and the / command parsing from the same data structures.)
That is exactly how it works — Jan designed a very nice mechanism that is used for this.
>
> 2. I recommend we drop the one-letter shortcuts, for several reasons:
>
> - Such tricks always cause evolution problems. One day, we'll add a new command whose first letter conflicts with that of an existing command, and which arguably has a superior claim to that short form.
>
> - Tab-completion works against / commands. So users looking to save keystrokes can use tab completion; the one-letter version now saves only the tab keystroke.
>
> - The commands are not that frequently typed, compared to evaluating expressions. So the extra keystroke savings (especially given tab completion) are not worth it.
>
> In short, I don't think they pull their weight.
Makes sense
And I use the shortcuts — well, a few of them.
Would love other’s thoughts.
>
> 3. I don't think we ever came to consensus on /edit. Right now, the popup editor says "experimental"; did we declare success or failure on this experiment? I thought we were leaning towards dropping it.
Right, no closure on the default simple window.
Other’s thoughts?
>
> 4. The /list behavior is a little confusing until you understand it. Perhaps the display should include a one-line header to the effect of "n implicit entries, type /list all to see", so that users won't be confused as to why the first entry is 9 and not 1.
We could, but that seems noisy — though I guess it would only be in default feedback mode (but the thinking is that is where most people will live).
I’ve been thinking that the welcome message, instead of advertising /help, would suggest a /intro — which would give a pocket intro including discussing /help, would talk about anything surprising, like this, and describe setting feedback mode, and how to save start-up definitions/commands.
>
> 5. /drop name. For most droppable things, "name" is a nice shortcut, and the interactive message we get when a method is overloaded is a fine compromise (rather than making the syntax more complicated.) But, it may not be obvious the first time that the user is supposed to type "/drop 12" when presented with a list of candidate IDs. The disambiguation text could guide the user to this a little better.
OK
>
> 6. /drop import. I am not sure how to drop an import, but there needs to be a way to do this (otherwise, a mistaken import taints the session.) I tried /drop id with the import id, and didn't get an error message, but it didn't have the effect of dropping the import, either.
Yep, known bug: JDK-8081431 <https://bugs.openjdk.java.net/browse/JDK-8081431>
>
> 7. /open. If I enter some expressions (e.g., 1+1), /save it, and then /open that, I don't see the expressions being printed as they are being re-evaluated. I realize that /open is mostly for pulling in canned declarations, but I found the lack of printing out any notifications confusing.
Hmmm, this interacts with the ongoing level of feedback question, but depending on what you are opening this could be very noisy.
>
> 8. /methods. I was a little surprised that I didn't get the sources for methods I'd typed in. Perhaps an option on /methods to get the source too? Ditto for classes. (Also, /classes lists the names but not the generic type variables, which is part of the signature -- so I get signatures for methods but not for classes.)
I saw these as a "what do I have" kind of query not a version of /list. Maybe "/list methods"
???
>
> 9. /reset. Should mention that it re-reads the startup file, so the state is reset to the as-started state, not the "empty" state.
OK.
>
> 10. /prompt. If we're going to support customization of the prompt, then we should allow the user to select a prompt with "/prompt repl> “
Fair enough
>
> 11. /classpath. No way to *list* the class path or to *remove* an entry from the class path.
JDK-8129539 <https://bugs.openjdk.java.net/browse/JDK-8129539>
Added a comment that we also need list functionality
>
> 12. I like the /n, /-n, and /! commands. We had discussed aligning the temporary variable numbers with snippet id's, so an expression snippet whose id is 33 would assign to temporary $33. The only weirdness with this is that people would be initially confused that the first temporary var is $9 and not $1, since we treat the startup commands as if they were input by the user.
I still think that is a good idea. There are a few other little curly bits: the user has defined a variable $2 we skip id 2, do we still define variables for snippets with no value, if so, what type? A snippet matching an existing snippet signature keeps the same Key and thus id, but then it should use the same temp variable and, oops, the type may have changed. …
-Robert
>
>
More information about the kulla-dev
mailing list