Proposal: other operators

Are there any other operators we should consider adding?

What about allowing for custom operators?

I see a few threads open about what operators should & should not exist. It’s a big question when operators are limited to a finite set, but not so when they’re extensible.

Plus, having custom operators makes the language more consistent, as there is no gating around what functionality is special enough to get a symbol and what isn’t

Custom operators come with a large number of complications. For starters, mental overhead - ‘should this be a two argument function or an operator?’. There’s also the problem of precedence - custom defined precedence systems are annoying on a good day, and outright unmanageable on a bad one (see C and Haskell as examples of precedence, custom or otherwise, being obscure).

A further complication is parsing and the grammar. If you want an easy to parse language, you’re much better off ditching custom operators. See for example, APL, which has custom operators and uses space for various things. The sequence (A B C D E F) cannot be parsed statically in APL, due to the numerous interpretations - E could be a function or a value or an operator and soforth.

Custom operators come with another downside also, in that they can cause conflicts by simply including a library. If you have two libraries defining ~~ or something else, then you have a naming conflict. This implies that custom operators should be versioned/hashed like functions so that you can ‘hydrate’ code with the full name, at which point you have just made operators effectively equivalent to functions, but different in weird cases.

A better solution may be to allow any two-argument function to be used as an operator, but that likely comes with it’s own challenges. I believe there are some languages that do this, but I’d have to research.