Skip to content
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

'equal?' on maps and seqs ignores the default #44

Closed
slburson opened this issue Jan 18, 2024 · 1 comment
Closed

'equal?' on maps and seqs ignores the default #44

slburson opened this issue Jan 18, 2024 · 1 comment
Assignees

Comments

@slburson
Copy link
Owner

Paul ran into this; see 9810f53 (reverted in 84a734f). Racking my brain to try to remember whether there was any specific reason I might have done this intentionally; it seems obvious that the defaults should be checked. But I don't yet recall any such reason.

@slburson slburson self-assigned this Jan 18, 2024
@slburson
Copy link
Owner Author

I've decided to consider this a bug, and go ahead and fix it. There is, admittedly, a possibility that someone out there is depending on the current behavior, possibly inadvertently, but I think the odds are minuscule. The most common reason for testing equality on collections is when placing them in sets or using them as map keys, which in my experience is a very rare thing to do with maps; I'm not sure I've ever seen it. With seqs, it might be slightly less rare, but I expect it's quite a bit rarer to use defaults on seqs than on maps. So the most likely scenario in which this change would break your code would be where

  • you are using maps or seqs as set elements or map keys
  • you are giving them defaults
  • you are giving different instances different defaults
  • but, you are depending on those different defaults not mattering for the set or map lookup

Each of these is unlikely, and the product of four small probabilities is extremely small.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant