Re:C++26: A Placeholder with No Name
by Koshkin on Saturday January 11, 2025 @10:33AM
(#42666509)
‘auto’ (in C++) and ‘var’ (in C# and Java) is a blessing, makes code much less verbose. Also good for refactoring - less code to change.
[ Parent
| on HN ]
I’m only a C++ amateur, but IMHO C++ vs C#/Java isn’t really a fair comparison here—the latter doesn’t have template shenanigans and so types are much more transparent to the reader (by which I mean that you don’t have to execute a dynamically-typed program in your head to get from the term on the right-hand side to the type on the left).
Re:C++26: A Placeholder with No Name
by bigstrat2003 on Saturday January 11, 2025 @02:49PM
(#42668458)
Verbosity is not bad. When it makes the code clearer, it is even a good thing.
Complex type parameters make explicit typing highly impractical to be used all the times
I like rust's approach in that it allows a mixture of explicit types and type inference using placeholders
For example: "let x : Result<Foo<int, _>, _> = make_foo();"