Dawid Weiss created LUCENE-10136:
------------------------------------
Summary: Lift the restriction on using 'var' variables
Key: LUCENE-10136
URL: https://issues.apache.org/jira/browse/LUCENE-10136
Project: Lucene - Core
Issue Type: Wish
Affects Versions: main (9.0)
Reporter: Dawid Weiss
Can we lift the restriction on using 'var' on the main branch? I know it's a
double-edged sword and sometimes it leads to unreadable code, especially when
you invoke a method, for example:
{code}
var foo = myMethodThatDoesSomething();
{code}
but in many, many, *many* cases the var keyword shortens the code and the type
is obvious from the context. This happens in loops, try-with-resources and
local variables.
{code}
for (var it = array.iterator(); it.hasNext();) { ... }
try (var foo = new MyFoo()) { ... }
{code}
I'd say - let's allow vars (and other language features) and use common sense.
If something is not clear in the context, type the variable. If something is
obvious, use shortcuts.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]