--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Both operators are actually useful (which one of them should be the short ==
is another question). We need the non-strict one because it’s consistent with <
and >
.
Imagine if we only had this:
1.0 > 1 #=> false
1.0 < 1 #=> false
1.0 === 1 #=> false
It’s not hard to imagine that this behavior could cause issues in a dictionary that relies on the term order. So we need the non-strict ==
to handle these scenarios. Using Alexei’s proposed eq/2
would be not be satisfactory for a dictionary that should handle all terms in the language.
And on the other hand ===
is needed for every dictionary type relying on strict equality where dict[1] != dict[1.0]
.