LVTI Style Guide

John Rose john.r.rose at
Fri Mar 23 17:17:16 UTC 2018

I'm also very pleased by Stuarts writeup.  Piling on about IDEs:

On Mar 23, 2018, at 1:51 AM, Tagir Valeev <amaembo at> wrote:
> Please share your opinions on this! Probably there should be an official
> recommendation from JDK team to IDE authors (not only IntelliJ) on whether
> the 'var' suggestion is considered a good style.

As Stuart says, there is an unavoidable element of human discretion
here.  So it seems to me that, in Intellij terms, the decision shouldn't usually
start with an inspection, a prompt from the IDE with a yes/no answer, but
rather a refactoring, which starts with a user decision and elicits user input.

Var-ifying a declaration should always involve rethinking whether to add
more type information to the variable name.  So perhaps the IDE should
provide a check-box item (a sticky one) on the Rename Variable refactoring,
rather than creating a separate "Toggle Var" refactoring with a name field.

(By "sticky" I mean that if I just var-ified one line of code, it's likely I may
want to var-ify the next, so I shouldn't have to tick the box twice.  And
similarly in the other direction.)

To Remi's suggestion that the decision is sometimes blockwise, which
Stuart also alludes to, perhaps the IDE's Rename Variable refactoring,
or something like it, could apply to a whole block or selected set of
declarations, collecting a whole roster of more type-ful names for
a series of var-ified declarations.

— John

More information about the amber-dev mailing list