#441 closed change request (fixed)
equal? may not recurse into closures
Reported by: | felix winkelmann | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 4.9.0 |
Component: | core libraries | Version: | 4.6.x |
Keywords: | equal? procedures | Cc: | |
Estimated difficulty: |
Description
Because it is impossible to avoid circular data when comparing closures and since equality of procedures is a difficult issue in general, the implementation of equal?
should be changed to not descend recursively into procedures and comparing them with eq?
instead.
This is a change-request, because such a change in the semantics of equal?
may break existing code.
The discussion period will end on 2010-12-21.
Change History (8)
comment:1 follow-up: 2 Changed 14 years ago by
comment:2 follow-up: 3 Changed 14 years ago by
Replying to alaric:
One underlying issue is: Who compares procedures, anyway? What are their intentions and wishes?
When comparing records, some slots may contain procedures. Another case is hash-table keys - here procedures may appear contained in non-atomic data compared by equal?
.
comment:3 follow-up: 4 Changed 14 years ago by
Replying to felix:
Replying to alaric:
One underlying issue is: Who compares procedures, anyway? What are their intentions and wishes?
When comparing records, some slots may contain procedures. Another case is hash-table keys - here procedures may appear contained in non-atomic data compared by
equal?
.
Oh, indeed; but what is the desired outcome for people doing this? What are they trying to do?
comment:4 Changed 14 years ago by
Replying to alaric:
Replying to felix:
Replying to alaric:
One underlying issue is: Who compares procedures, anyway? What are their intentions and wishes?
When comparing records, some slots may contain procedures. Another case is hash-table keys - here procedures may appear contained in non-atomic data compared by
equal?
.
Oh, indeed; but what is the desired outcome for people doing this? What are they trying to do?
Use arbitrary objects as hash-table keys.
comment:5 Changed 14 years ago by
The discussion period has ended. Please give your vote on the following change:
comment:6 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
No rejections, so this appears to be accepted.
I think that
eq?
is probably good enough for procedures, on account of the slipperiness of defining equality for them.However, should
equal?
be extended to terminate on circular data (as R7RS may end up requiring), then recursing into procedures will also be good enough (and, indeed, perhaps slightly more useful thaneq?
).One underlying issue is: Who compares procedures, anyway? What are their intentions and wishes?