mleku on Nostr: Operator is a red flag... builtin logic should only apply to values, and values, ...
Operator is a red flag... builtin logic should only apply to values, and values, specifically, that are based on the CPU's built in types
vertical bars | are generally used as either bitwise OR or as concatenation operators for cryptographic operations, for example
but there's some nasty ambiguity there... append(first, second...) is unambiguous
i'm not gonna say anything about inheritance just focus on the point of redefining operators
many languages now allow you to redifine any infix, postfix or prefix operation on many other types
this creates ambiguity in the mind of the programmer, what does this + mean? addition? concatenation? encapsulation?
the more i have to think about what a common operation means, the more likely i am to not understand what two variables with this operatior between them means, and that increases the risk that i'm going to miss a bug
vertical bars | are generally used as either bitwise OR or as concatenation operators for cryptographic operations, for example
but there's some nasty ambiguity there... append(first, second...) is unambiguous
i'm not gonna say anything about inheritance just focus on the point of redefining operators
many languages now allow you to redifine any infix, postfix or prefix operation on many other types
this creates ambiguity in the mind of the programmer, what does this + mean? addition? concatenation? encapsulation?
the more i have to think about what a common operation means, the more likely i am to not understand what two variables with this operatior between them means, and that increases the risk that i'm going to miss a bug