What's in an operator
Currently in my programming language I have not implemented common operators such as + or >. As I have replaced these by functions, such as ‘plus’ or ‘greaterThan’, I couldn't help but wonder what I was leaving behind.
In this trip back to basics, let’s leave aside what it compiles to, which is, without optimisations, obviously distinct. Just considering the syntax level, there’s the following:
Postfix syntax
The most obvious thing is that operators, most of the time, come between expressions.
‘a + b’ reads a bit different than ‘plus(a, b)’. Sprinkling some syntactic sugar and bringing it to ‘a->plus(b)’ already reads in the same order, albeit quite more polluted and handwaving the discussion if that arrow isn't an operator in itself.
Priority
We expect there to be precedence in operators. ‘a + b > c + d’ is not something we expect to be executed left to right. ‘a->plus(b)->greaterThan(c->plus(d))’ is more explicit in execution order. Succinctness is out the window when we replace math symbols with words.
Short-circuiting
This is the most interesting one because ‘f() && g()’ is not the same as ‘f()->and(g())’ because ‘g()’ is only executed if ‘f()’ gives us true. This gives two potential choices for the signature of ‘and’:
// without short circuit
and: (a: Boolean, b: Boolean) ~> Boolean
// being explicit about the short circuiting, but requiring a function
and: (a: Boolean, b: () ~> Boolean) ~> BooleanAs I thought not having short-circuiting there would be the least expected behaviour, I ended up with the arguably awkward function signature that requires a function to be passed in.

