People who are OK with vars in tests - are you also the ones who are going to write vars from now on yourself or you just do not mind if you encounter it?
There is a difference between "keep it in tests, I am going to use this, this is actually a good idea" and "keep it in tests if people are going to use it, I do not mind but I am not going to change my style". If the latter is the case, then who is actually going to write tests on a daily basis with vars? If one or two people then I guess it does not make a lot of sense to keep it around. On Mon, Nov 4, 2024 at 11:10 PM Ariel Weisberg <ar...@weisberg.ws> wrote: > Hi, > > I don’t like `var` anywhere. Even if IntelliJ could automatically insert > the concrete type it would still be a problem in the GH compare view. GH > compare view is a real problem, because any time something is sufficiently > obfuscated I have to bounce back and forth with an IDE, check out the code > etc or just proceed with a weaker mental model of what is going on. > > I have finite mental energy to expend every day and I don’t want to spend > it hunting down and then recalling what each instance of var means > repeatedly. It uses almost no energy to read past extra type information > (formatting means I don’t even need to parse it) or do a little extra > typing/autocomplete > > Ariel > > On Tue, Oct 29, 2024, at 1:13 PM, Štefan Miklošovič wrote: > > Hello, > > this should give you an idea > > grep --include '*.java' -r 'var ' src/ test/ > > I think this is a new concept here which was introduced recently with > support of Java 11 / Java 17 after we dropped 8. > > What is your opinion? Are we free to use it wherever we want? I am quite > conservative in this area and I will most probably still use types as we > know them but maybe in tests we might relax it a little bit? Or production > code with "var" is totally fine too without any concerns? I think this > should be covered by the code style. > > Regards > > >