News for hackers. Stuff that matters.
Re:C++23: The Next C++ Standard by coldpie on Tuesday July 11, 2023 @03:01PM (#36685728)
Ah, matrices! Does * mean dot product, cross product, or the usually less useful matrix multiplication? Ooh, or maybe you should you use . for dot! How clever that would be!

> And that's speaking as someone who once implemented a path class with a subtraction operator that would return the relative path between two absolute ones. I thought I was very clever.

Haha! It's ok. The temptation to be clever with operators is too strong, few can resist before getting burned (or more usually, burning others!) at least once.

Re:C++23: The Next C++ Standard by owalt on Tuesday July 11, 2023 @05:03PM (#36687185)
> Ah, matrices! Does * mean dot product, cross product, or the usually less useful matrix multiplication? Ooh, or maybe you should you use . for dot! How clever that would be!

Why the snark? The fact that you're free to make a bad choice does not imply that having a free choice must be bad. Obviously neither dot nor cross product should be *. It should be the Hadamard product or matrix multiplication. You can choose one convention for your code and be perfectly happy for it.

As a follow-up question: How do you feel about languages like Fortran and Matlab then? Is it actually a good thing that mathematics convenience features are relegated to a few math-oriented languages and kept away from all the others? (Or are the linear algebra types in these languages offensive as well?)

Re:C++23: The Next C++ Standard by kps on Tuesday July 11, 2023 @06:40PM (#36688216)
Maybe C++26 will let us write operator·() and operator×().
Re:C++23: The Next C++ Standard by enriquto on Tuesday July 11, 2023 @07:15PM (#36688451)
In C++34 we'll finally have a way of overloading the empty string operator, so that we can, at last, write AB for the product of matrices A and B. As God intended.
Re:C++23: The Next C++ Standard by andrewf on Tuesday July 11, 2023 @08:25PM (#36688942)
Stroustrup, B. (1998, April 1) Generalizing Overloading for C++2000. AT&T Labs. https://www.stroustrup.com/whitespace98.pdf
Re:C++23: The Next C++ Standard by woooooo on Tuesday July 11, 2023 @06:45PM (#36688248)
The benefits from operator overloading are "I can show this to a mathematician and it looks like what they're used to". The downsides lurk in the corners of whether it's actually doing what you think.

I'll pass.