3 ms·
> I wonder why user-defined operators are considered any worse than user-defined functions. User-defined functions can take more than two parameters. User-defi
by humanrebar 12y ago
> I wonder why user-defined operators are considered any worse than user-defined functions.
User-defined functions can take more than two parameters. User-defined operators have one or two parameters (allowing rare exceptions).
User-defined functions can have any signature and specify any contract. To prevent surprises, user-defined operators should return a boolean or a number. Not a Maybe<Number>. Not a return code. Not a LazilyConvertsToFloatWhenYouCopyIt.
That being said, I like user-defined operators and the ability to overload operators. But there are tradeoffs, just like in any engineering decision.