"โน๏ธ".reverse() == "๐"
"โน๏ธ".reverse() == "๐"
"โน๏ธ".reverse() == "๐"
but sometimes "๐๐ฝ".reverse() == "๐ฝ๐"
Imagine, if you will. A world where string reverse changes the character codes of the string.
What beauty, what wonder would such a world have?
Destruction and despair. Developers unsure why their programs donโt respond correctly. Ships run aground on islands already overcrowded with those who were shipwrecked before. Signal antennas pointed towards the sun with itโs constant noise. Spacecraft whose exhaust melt to slag populated cities as people briefly scream their final terrors of pain and suffering.
This, is a world we should not want to live in. A world you can only find, in the Twilight Zone.
Nah, this could've been possible with some clever fuckery in defining those emojis' unicode content, like with flags that are not a single point but three independent ones, allowing you to do this:
undefined
"๐ง๐ฌ".reverse() == "๐ฌ๐ง" "๐ฌ๐ช".reverse() == "๐ช๐ฌ"
THANKS. I didn't get the flag joke at first @sukhmel@programming.dev
"๐".reverse() == "๐"
Then we need reverseX and reverseY
๐.reverseX = ๐
"๐ฎ๐ช".reverse() = "๐จ๐ฎ"
Has someone made a library for that?
Use a dynamically typed language and you won't have to: just override the default reverse()
method on strings like a Real Programmer!
Unintended consequences you say? Nonsense! What could possibly go wrong?
Iโm tempted to publish an NPM package to do so as a joke, but I fear that itโd get used seriously
Lua could possibly do this
Yet we live in a world where
undefined
File "<stdin>", line 1 "๐".reverse() = "๐" ^ SyntaxError: cannot assign to function call
It is a font that changes ==
to one long equals sign.
Oh my bad, that idea didnโt cross my mind.
undefined
Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'str' object has no attribute 'reverse'
"A".reverse() === "A"
"A".reverse() == "โ"
Where is your god now?!
What's with the lines of both equals symbols being combined together haha?
That's known as a ligature and they're pretty common in many programming-oriented fonts, which usually have stylistic sets with different ligatures for different programming languages that you can optionally enable in your editor's configuration. For example, here's the stylistic sets the Monaspace font offers:
Personally I'm not too fond of ligatures so I never enable any, but many folks do like them.