Comment by kibwen

4 years ago

One glorious day we'll accept programming languages that require spaces around infix arithmetic operators so that we can make kebab case a reality!

Forth does something like this, by virtue of its reverse Polish notation.

In Forth, 'words' (which are roughly analogous to functions and operators) must always be separated by whitespace, as Forth doesn't parse out operators the way most languages do. In exchange, you get the ability to use symbols in identifiers, as Forth has no reason to single out symbols like + as being syntactically special. You can even use a number for the first character. (For that matter, Forth will even let you override the usual interpretation of a numerical literal, but that's always struck me as going a bit far.)

It gives you a + word, analogous to the + operator of most languages [0]. It also gives you a 1+ word, as an (admittedly slight) abbreviation of the sequence 1 +. [1] If you wanted a 2+ word, you could easily define it yourself.

(This property of Forth evidently wasn't enough to get it to take over the world, but it's still neat.)

[0] https://www.complang.tuwien.ac.at/forth/ansforth-cvs/documen...

[1] https://www.complang.tuwien.ac.at/forth/ansforth-cvs/documen...

Lisps, especially Scheme with its `x->something-else` convention, have ruined naming in other languages for me.