The assignment operator (=) does not return a value, to prevent it from being mistakenly used when the equal to operator (==) is intended. – Steve Jobs
What is the assignment operator, in English?
Swift code to support this post:
enum Color {case pink, blue} dress.color = .blue
The mental model I’ve had, for that assignment, has either been
Dress’s color? Make it blue. (asking the universe)
or
Dress, your color? Make it blue.
If your mindset, like mine has been, is that you’re asking something to cause the assignment to happen, whether it be some object in particular, or the universe, I think “=” can always be translated to “, make it“.
But you know what? I don’t know why I’ve been asking the universe to make it so hard on me. Sure, I understand that this way of thinking is more accurate, but that doesn’t mean that it’s the abstraction that human brains are most suited to embracing. This seems a whole lot easier:
Dress’s color, be blue.
I’m going to start thinking of = as “, be”.
Swift’s equality operator is pointless.
== is ridiculous. Sometime when I was a bunch of stuff that hadn’t turned into a babby yet, there was a person who wanted to use =, but, because it was already taken, decided to just type it twice.
For translating == into English, “be” works again, but without the comma and space. I’ve been brainwashed to believe that conjugating to “is” is easier to think about that “be”, but they both work.
Swift: if dress.color = .blue
English: If dress’s color is blue
Piratenglish: If dress’s color be blue
We have the capability to infer whether = is “, be” or “be”, in context. I’m not saying that = is the best option for either, but it’s certainly better than ==.