Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Some teams discourage it because it makes code reviews a little harder

Not just reviews, but anything that involves reading the code (which is frequently usage and maintenance). Swimming in a file where everything is auto is a special kind of hell. It's like having no firm ground to step on.



I used to despise auto as well but with new standards it’s just powerful. It’s better to truly understand how type deduction works, you’re gonna be a much better C++ programmer.


> It’s better to truly understand how type deduction works, you’re gonna be a much better C++ programmer.

I understand how type deduction works just fine, thank you. Your assumption that I (or many others) have this stance based on some lack of understanding of how type deduction works is extremely wrong, and completely missing the arguments people are actually making.


I would expect most people to read code in their IDEs, where small amounts of type inference like this is fine because the IDE tells you what the type is.

I agree that if you spend a lot of time reading code in something like GitHub, not having explicit types is annoying, but seriously, who does that?


I can come up with a few more examples.

- No review tool is capable of providing type inference hints.

- Not everybody's development workflow consists of using the IDEs.

- Development/debugging on remote machines does not even have a GUI to start with - so no IDEs there as well.


If the IDE only displays the type on hover, that’s a significant usability regression.

It also makes it harder to grep for usages of any given type. Of course IDEs could help with that too, but I don’t know any that provide that functionality.


IDEs don't always display every type in a useful way. Sometimes they just display an unhelpful alias which ends up being just as useless. Sometimes they display an incredibly verbose version with all the default template parameters written out, making it a nightmare. Sometimes they give useless results, like when you have a dependent type whose concrete type you know (imagine typename T::value_type vs. size_t). Sometimes they haven't even finished analyzing the code yet. I could go on. You should not be crippled without your IDE.


>You should not be crippled without your IDE.

Can you compute elementary functions by hand? Why not? Why are you crippled without semiconductors? This attitude leads to never being able to use better tools. We can't leverage an IDE because then we're "crippled" when we don't have it, so we continue writing code as if it was the '70s and the best we have is ed.


Well pr reviews are usually don’t in gh or other web platform so, many people?


it's like trying to read untyped python code, which is my personal hell


I do wonder, you arent using IDE?


In my experience even something like Pycharm can't inference types properly across function boundaries unless you explicitly provide type hints.


But hes talking about cpp


I misunderstood you I guess. I thought you meant using an IDE to infer the types for untyped Python.


One could be reading from browser (git/hub/lab)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: