4 ms·
I wouldn’t say it’s common, but it’s not exactly rare (to reasonably say “unique”) either. At the end of the day it’s just a form of operator overloading, and
by uranusjr 7y ago
I wouldn’t say it’s common, but it’s not exactly rare (to reasonably say “unique”) either.
At the end of the day it’s just a form of operator overloading, and is generally present in languages that value expressiveness. Python and C++ (as mentioned), as well as Ruby, Rust, Kotlin from the top of my head. There are many more.
By the way, slightly off-topic—Swift does have a fairly unique feature regarding operators: you can create entirely new ones, not just overloading those existing for some other types.
- pjmlp 7y agoThat unique feature is available to any language that support symbols as names. All Lisp and ML derived languages, for example.