Re:Tests aren’t enough: Case study after adding type hints t...
by layer8 on Monday October 18, 2021 @05:02PM
(#28911685)
I agree it's redundant if the type name occurs twice in the same statement. However, further evolution of the code often causes the instantiation to be moved elsewhere, and I wouldn't have confidence that the one doing that change then also changes `var` back to the type name. Instead, it would be nice to have syntax avoiding the duplication in the fashion of `FooBarBazThingyWithALongName thingy = new(...constructor parameters...);`.
Re:Tests aren’t enough: Case study after adding type hints t...
by Serow225 on Monday October 18, 2021 @06:12PM
(#28912483)
C# 9 now has "target-typed new expressions"
https://www.thomasclaudiushuber.com/2020/09/08/c-9-0-target-...
In an IDE you can get the type annotation from the IDE over every inferred var type, but I don't like requiring an IDE to see that information and like it showing up in 'less' as well.