GulfOfMexico
GulfOfMexico copied to clipboard
Negating Numbers, and Logical Not
; is a logical not, and traditionally, negating numbers uses a -. It's sort of a similar thing, right?
- They're both reversible (
;;a == a&&--a == a) - They also both have one to one mapping (
aonly has one value for-a, and vice versa.aonly has one value for;a, and vice versa)
Why not just remove the -, and make negative 3 be described with ;3?
It also makes a nice winking face ;3
That's true. We know from JavaScript that operator overloading is terrible (which uses + for adding AND concatenating).
So we must not overload the - operator. Currently it does subtracting AND inverting numbers. This is very confusing. Inverting numbers should be changed to ; I think.
Precisely, any symbols that are overloaded should have reasonable logic behind it. And ;3 is reason enough.
then how do we concatenate strings?
We can't use + because that's add.
We can't use ++ because that's increment.
I guess we'll have to use +++.
What about using an &?
const const name = "Lu"!
"Hello, " & name & "!"? // Hello, Lu!
It's kind of makes sense from a reading englishy standpoint, but I'm not sure what your stance is on logical and - is that &&, like JavaScript?
Edit: Just found out that Ada, Modula-3 and Visual Basic all use
&for string concatenation, so it would make sense from the user's point of view to use the syntax that they are familiar with. Namely, the syntax of a language that they have never heard of before.
if & is to be used for string concatenation, I'm curious to hear people's thoughts on bitwise and. Are the operators just the words and, or, xor, etc.? Or perhaps to be extra clear that these are for bits only and not for logic, there is a b in front of them as in band, bor, bxor and so on? Other ideas?
Edit: another example of b-prefixing (bfixing?): bnot
Maybe bitwise and should be 01100001 01101110 01100100?
So we must not overload the - operator. Currently it does subtracting AND inverting numbers.
Why do we need an operator for subtraction? Isn't subtraction just adding an inverted number?
Good point. And since - wouldn't indicate subtraction, the increment/decrement operators should be ↑ and ↓, not --. With that in mind, what should we do with the - character?