Trait operators / macro traits

My observations aren't about your specific examples. I did use your examples in questions that arise (namely with the precedence, associativity, and ambiguity), but this is something inherent to the idea. To be a custom operator there has to be some syntax a the usage site. There's the possibility of the Haskell `opname`syntax that I think no one would like in practice, though `opname does show up in one of the threads linked below..

And are we not discussing it? There is little provided on the "pro" side right now, sure, but who do you think should provide such information?

I did read it. Have you researched prior discussions about custom operators on here? It happens fairly regularly and the problems are almost never about how to declare such things, but how it'd actually work in Rust regardless of how you end up spelling any declarations in the code.

Some samples (some of which are about specific operators still causing problems, nevermind arbitrary ones):

I've mainly seen it in code like container `contains` item where the "operator" reads well in English with its argument order.

5 Likes