News for hackers. Stuff that matters.
Re:Zig, the Small Language by Kukumber on Wednesday September 07, 2022 @01:19PM (#32753420)
> I prefer when the function call is explicit, it is a bit more cumbersome to write, but there is less hidden complexity.

you hide and obfuscate basic operations with functions, that's worse, specially when you have to chain arithmetic operations, with functions it becomes ugly and unreadable

Re:Zig, the Small Language by stephc_int13 on Wednesday September 07, 2022 @01:37PM (#32753611)
Matrix multiplication or even worse, matrix inversion, is NOT a basic operation.

This is exactly the point.

Re:Zig, the Small Language by kllrnohj on Wednesday September 07, 2022 @02:51PM (#32754733)
> Matrix multiplication or even worse, matrix inversion, is NOT a basic operation.

Neither is dividing floats, especially not on a softfloat & softdiv architecture. And yet, Zig is perfectly OK with you using division between 2 floats. Why does it get to insert expensive function calls behind operators but I can't?

Zig also lets you do remainder division for floats, which is also not a "basic operation." It's slower even then taking the sqrt of a float! Zig then also has specialized operators like saturating addition, which also isn't a "basic operation"

And then Zig also has `*` for array multiplication and `++` for array concatenation. Those are compile-time only, but still deviates from "basic operations only" territory surely. And also Zig overloads `||` to allow for the merging of enums (sorry, "error sets"), rather than only being a boolean OR.

Re:Zig, the Small Language by littlestymaar on Wednesday September 07, 2022 @02:10PM (#32754051)
Integer division isn't a simple one either though…

Matrix multiplication are “basic operations” in the sense that you use them as the basic block of your algorithms, and in code using such blocks you really appreciate having a simple operator for those instead of littering your formula with functions calls (which is basically writing your formulas in Polish notation, not the most legible way to write formulas …)

Re:Zig, the Small Language by dolmen on Friday September 09, 2022 @05:03AM (#32777028)
Matrix multiplication is a niche in the programming world.
Re:Zig, the Small Language by littlestymaar on Sunday September 11, 2022 @05:27PM (#32803444)
The programming world is made of niches. That's why arithmetic operator overloading is nice, the language doesn't need to know which niche I'm in to satisfy my needs.
Re:Zig, the Small Language by cycomanic on Wednesday September 07, 2022 @02:27PM (#32754321)
I somewhat agree with you, I argue that mat*mat should be an element wise operation and use a different operator for matrix operations (like numpy does it).
Re:Zig, the Small Language by stephc_int13 on Wednesday September 07, 2022 @01:33PM (#32753566)
Show me an example and I am pretty sure that I can rewrite it in a way that is neither ugly nor unreadable.