-
Notifications
You must be signed in to change notification settings - Fork 3.4k
More Enum.equal? stuff #983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The protocol (or a protocol wrapper, which is the case for Enum) should not There are many cases we could fit in here, for example, any ordered set or José Valim |
I don't buy this argument. Having all cases slow is worse than having |
The list specialization is available to all types. A set could use it. I am not saying we shouldn't specialize, all I am saying is the José Valim |
Range is quite built-in, though.
|
So add I was somewhat against the specialization for just ranges, but @shurizzle insisted I should do it, and in the end I considered ranges built-in given there are translations in Nonetheless, considering adding I can remove that commit for now and think about it later tho. |
I would still say specializing for Range sounds quite reasonable to me (it really is quite built-in) |
Any news on this? I'd at least like to have |
We should remove that and make it general, it is just low priority.
I think this would be the way to go. If both iterators are equal, dispatch to the protocol. The problem is that we can't know if they are equal without #950. So I am closing this for now until we get #950 in. Thanks @meh ! |
Ugh, my bad. Reopening this as I missed |
Added a specialization for Range, because it could do a lot of useless work when comparing two ranges.
Also added
Enum.equal?/3
with an additional function to check for equality, useful in many situation, and also to easily compare with===
instead of==
.