You're not always going to be looking at code through an IDE, though (i.e. if I'm looking at a code review on GitHib, which honestly makes up a lot of my time spent), and for large projects, the indexing that makes that happen can be painfully slow and sluggish to use (I'm looking at you, Eclipse). And either way, it's always going to be better for readability if the information I need is right there on the screen for you, not hidden behind clicks and interaction with the IDE.
I have been of the opinion in c++, that if the type isn't obvious then you shouldn't use auto. That doesn't mean auto isn't useful iterators are horrible to write, using auto it = myVector.begin(); makes it alot more pleasant to both read and write. However I would use std::string result = aClass->someFunc(); Best of both worlds but getting people to adhere to it can be a nightmare.
"But you can use it to write bad code" is always the argument against introducing a language feature. It doesn't matter which feature. Someone will say it's a bad idea because you can write bad code with it.
Guess what? You can do that with any feature. It's a bad argument.
"It encourages bad code" is a reason against introducing a language feature. Even for things that are controversially bad (i.e. not everyone agrees they're bad).
10
u/lamarf Mar 09 '16
You're not always going to be looking at code through an IDE, though (i.e. if I'm looking at a code review on GitHib, which honestly makes up a lot of my time spent), and for large projects, the indexing that makes that happen can be painfully slow and sluggish to use (I'm looking at you, Eclipse). And either way, it's always going to be better for readability if the information I need is right there on the screen for you, not hidden behind clicks and interaction with the IDE.