Open PumpkinSeed opened 7 years ago
The real reason ===
is bad, is that ==
still works, except it can get you into real problems in edge cases. ==
and ===
still should do something in PyHP++#
I propose that ==
returns a the string "the values $a and $b are the same"
if they are and "the values $a and $b are not the same"
if they are not. (with $a
and $b
substituted for the correct value). That way (do to type contortion), the expression will always evaluate true.
===
should do something equally ludicrous.
Perhaps ===
should return the difference between the two. -2 === 5
would be 8
, 3 === -12
would be 16
, etc.
But then how do we actually check if two values are equal if neither ==
nor ===
does that?
equals(val1, val2) perhaps?
Although another problem arises if you override the functionality of ==, the original source code will end up being invalid.
That's true. Maybe we should keep ==
normal.
I've created operators
branch, I will add suggestions here to operators.md
.
Not too sure about it. I forget who said it, but I remember someone here saying something along the lines of "We want to make a bad language because it has all these different languages, not a bad language with elements from the languages thrown in. "
That's true, but all of the inspiration languages use ==
. PyHP++# is intended to be satirical and strange to work with, and so having only ==
would be against the 'feel' of the language. In a way it's like the inversion of False
and True
.
Javascript using
==
as comparison operators and===
as strict comparison operators. Can this new awesome lang using====
for not equal?For example: