I mean that there shall be somebody who has enough passion to refactor old codebase step by step to new style. E.g. I prefer inplace initialization and I am ready to periodically migrate old stuff.
auto
Absence of auto
was the best thing in Urho codestyle. Yes, I dislike auto.
removes the need to maintain and refactor code when changing types
eliminates the possibility of implicit conversion bugs
I have never faced such bugs, so I think they are quite rare. However, I can also imagine bugs that are caused by implicit changing of type of auto
variable. So it eliminates one kind of bugs and introduce another.
String A::foo(); // -> const char* foo()
...
auto a = foo();
if (a == "1") { ... }
less writing. Container iterators are a good example
Of course, impossible to argue. I use auto when WIP or for some simple local projects.
more readable. Container iterators are a good example- easy to use.
No, no, no, NO. auto
is more readable for some complex temporary types and it completely ruins readability in most other cases. It literally brings strong-typed language into don’t-give-a-fuck-about-type script language like python.
- It’s harder to explore code via file manager
- It’s harder to code via browser
- It’s harder to review diff in classical merge tools
- It’s harder to review diff in browser
- It’s harder to visually check dependencies of some piece of code
- It’s harder to determine type usage among codebase
- Search became useless
Programmer saves a minute by writing auto
. Readers waste an hour/day/??? by reading this mess.
So… Almost-Never-Auto is my choise.
Almost-Always-Auto guys say that reader don’t need to know about the type.
I say that if writer is writing code for people, he has no right to decide whether the reader needs type or not.
Almost-Always-Auto guys say that variable name is enough.
I say that type name is a ‘part’ of variable name and dropping of type is almost like dropping the name.
The worst thing is that experienced developeds have an immunity to such auto
disadvantages because they are familiar with codebase and they really don’t need explicit type. Problems started to appear as time passes, old developers forget codebase and new developers come.
In such big project as Urho, usage of auto IMO shall be strictly limited. Otherwise, its currently perfect readability will be partially destroyed.
This one is nuanced, and shouldn’t be used everywhere possible.
It is just almost unneeded. So I see no reason to bring inconsistency to codebase.
Huh, I finihed.