Default kulla messages
Martijn Verburg
martijnverburg at gmail.com
Tue Jun 23 10:26:27 UTC 2015
Hi Brian,
Anecdotally from our Hackday, many developers quite liked the default
verboseness but did express an interest in being able to reduce it once
they'd gotten used to the REPL. Just one data point mind you.
Cheers,
Martijn
On 22 June 2015 at 22:40, Brian Goetz <brian.goetz at oracle.com> wrote:
> The messages produced by JShell during the course of
> evaluation/declaration have been in a placeholder state for a while, and
> its probably time to paint the bikeshed of what the default messages should
> look like (there are multiple message schemes, which can crank up and down
> the verbosity, but the default set is the most important.)
>
> Here's what JShell prints now for an expression and a method declaration:
>
> -> 1 + 1
> | Expression value is: 2
> | assigned to temporary variable $1 of type int
>
> -> void foo() { }
> | Added method foo()
>
> These are all useful bits of information:
> - the result of the expression, if any
> - side-effects on the REPL state
> - temporary name and type, for expressions
> - var/method/class name and type, for declarations
>
> However, plenty of people have commented that these messages are "kind of
> verbose".
>
> The Scala REPL output contains all this information too, but more
> compactly:
>
> scala> 1 + 1
> res1: Int = 2
>
> scala> def m() { }
> m: ()Unit
>
> The Ruby IRB output is more taciturn:
>
> irb(main):001:0> 1 + 1
> => 2
> irb(main):002:0> def m()
> irb(main):003:1> puts "Hello"
> irb(main):004:1> end
> => nil
>
> The Perl re.pl even more so:
>
> $ 1 + 1
> 2
> $ sub m {
> > return 1;
> > }
> (empty line)
> >
>
>
> While we could gather more examples, I think there's a pattern emerging:
> expression evaluation should put the result front-and-center.
>
> Here are some possible options for the evaluation of 1+1 in jshell:
>
> --
> 2 (assigned to temporary $1)
> --
> 2 (assigned to temporary $1 : int)
> --
> $1 (int): 2
> --
> => 2
> (assigned to temporary $1 : int)
> --
> int: 2
> (assigned to temporary $1 of type int)
>
> There are obviously many more variations.
>
> I propose using, as the default level:
>
> => expression value
>
> to indicate the result of an expression, with statements producing no
> output, coupled with a convention to put all side-effect-on-REPL-state
> information in parentheses on its own line:
>
> repl> 1 + 1
> => 2
> (assigned to temporary $1 of type int)
>
> repl> void m() { }
> (defined method m())
>
> repl> /drop m
> (dropped method m())
>
> repl> int x = 3
> (declared variable x of type int)
>
> repl> x = 4
> (no output)
>
>
> I think this scheme captures the essential information without too much
> noise (users can select a higher verbosity level if they want.)
>
>
More information about the kulla-dev
mailing list