News for hackers. Stuff that matters.
Re:Why Zig when there is already C++, D, and Rust? by mhh__ on Friday January 15, 2021 @07:41PM (#25798662)
<< was necessary at the time
Re:Why Zig when there is already C++, D, and Rust? by edflsafoiewq on Friday January 15, 2021 @07:44PM (#25798695)
Why?
Re:Why Zig when there is already C++, D, and Rust? by mhh__ on Friday January 15, 2021 @08:22PM (#25798962)
C++ didn't have variadic templates so passing along a stream with an operator was more ergonomic enough and typesafe.
Re:Why Zig when there is already C++, D, and Rust? by edflsafoiewq on Friday January 15, 2021 @08:36PM (#25799044)
I suppose you're comparing against std::format, but the question is why overloading an operator (cout << "foo") would have been necessary vs a regular member function (cout.put("foo")).
Re:Why Zig when there is already C++, D, and Rust? by mhh__ on Friday January 15, 2021 @08:56PM (#25799168)
Because it had to replace people using a comma inside printf. The member function could only accept one argument cleanly so you would've to chain them like cout.put.put.put