News for hackers. Stuff that matters.
Re:C++26: A Placeholder with No Name by nly on Saturday January 11, 2025 @10:28AM (#42666479)
It's not 1993. IDEs tell you the type if you hover over the auto. Or control and click takes you to the type definition.

You have to weigh up the cost of going through the code and changing all the type declarations

    auto x = foo();
If you change the return type of foo here you don't have to change 300 call sites. Personally i'd rather change it in one place than 300.
Re:C++26: A Placeholder with No Name by ninkendo on Saturday January 11, 2025 @12:03PM (#42667181)
What about code reviewers? Show me a code review system that lets you hover over the value to see the type… none of the ones I’ve used can do it.

For that matter anyone reading the code from a web browser in any other context.

Re:C++26: A Placeholder with No Name by dgfitz on Saturday January 11, 2025 @12:32PM (#42667394)
Fwiw, I agree. I also pull down the branch under review in parallel to the web code review. You’d (probably) not be surprised by the number of times I’ve done this and the code doesn’t even build.
Re:C++26: A Placeholder with No Name by ranger_danger on Saturday January 11, 2025 @01:07PM (#42667711)
I wonder if most of the reason people use auto is just to save time when typing... if the IDE could auto-resolve the type in the source code when they use auto... would that be a better compromise?
Re:C++26: A Placeholder with No Name by ogoffart on Saturday January 11, 2025 @01:16PM (#42667785)
Even without auto you have the problem.

    return foo().bar();
No `auto` and you still don't know the return type of foo. And knowing the type might not be the only reason you'd want an IDE anyway. What is `foo()` doing? I want to be able to easily jump to the definition of that function to verify that the assumption taken by the calling function are correct.
Re:C++26: A Placeholder with No Name by ch33zer on Saturday January 11, 2025 @02:38PM (#42668374)
This was probably rhetorical but metas code review tool runs LSP and gives you clickable types where clicking takes you to the definition.
Re:C++26: A Placeholder with No Name by AlotOfReading on Saturday January 11, 2025 @11:05AM (#42666763)
Editor type deduction is surprisingly unreliable sometimes.