> For mathematicians, operators are essential to how they think.
But programming is not math, just like it isn't text, or color, or datetimes, or any other type of value our programs deal with. Even in programs I've written whose purpose is numerical processing, a vanishingly small fraction of the program involves doing math.
We have no problem using a domain-specific language (like regular expressions) for the occasions where we need to work with text. Likewise for querying a database (SQL), or text styling (HTML). We shouldn't need to infect the rest of the language with all the massive complexity of "operators" just to be able to write "a+b" in every possible context.
In fact, even when I need to do math, the built-in operators are too weak to support half the math I need to do. We're paying a huge cost, and not getting our complexity's worth.
It's not even visually correct. The example here is:
x + (y + z) == (x + y) + z
which is true in mathematics but not true in most programming languages, where the values could be implicitly promoted modulo integers of different widths, or IEEE-754 floating-point values. He says he wants operators so you can see that addition is associative, but in his language, it's not.
My favorite design, in terms of separating the syntax, is actually Tcl. Remove the complexity of needing infix arithmetic operators from 99% of the language, but keep it available for the times when you want it. It still doesn't support half the math I need, but at least the language was kept simple by having math ("expr") and text ("regexp") off in their own commands.
But programming is not math, just like it isn't text, or color, or datetimes, or any other type of value our programs deal with. Even in programs I've written whose purpose is numerical processing, a vanishingly small fraction of the program involves doing math.
We have no problem using a domain-specific language (like regular expressions) for the occasions where we need to work with text. Likewise for querying a database (SQL), or text styling (HTML). We shouldn't need to infect the rest of the language with all the massive complexity of "operators" just to be able to write "a+b" in every possible context.
In fact, even when I need to do math, the built-in operators are too weak to support half the math I need to do. We're paying a huge cost, and not getting our complexity's worth.
It's not even visually correct. The example here is:
which is true in mathematics but not true in most programming languages, where the values could be implicitly promoted modulo integers of different widths, or IEEE-754 floating-point values. He says he wants operators so you can see that addition is associative, but in his language, it's not.My favorite design, in terms of separating the syntax, is actually Tcl. Remove the complexity of needing infix arithmetic operators from 99% of the language, but keep it available for the times when you want it. It still doesn't support half the math I need, but at least the language was kept simple by having math ("expr") and text ("regexp") off in their own commands.