Summary
equal? may not recurse into closures
Metadata
- Id: 727cc4f666a781a1c89e66cd4ec2e4ac0ebd1ed8
- Trac id: 441
- Type: change request
- Reporter: felix
- Owner:
- Cc:
- Status: closed
- Component: core libraries
- Estimated difficulty:
- Resolution: fixed
- Priority: major
- Milestone: 4.9.0
- Version: 4.6.x
- Changetime: 2012-09-24 21:47:48 UTC
- Created: 2010-12-07 11:16:24 UTC
- Keywords: equal? procedures
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.
Changes and comments
[2010-12-08 13:03:18 UTC] alaric wrote:
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 than `eq?`).
One underlying issue is: Who compares procedures, anyway? What are their intentions and wishes?
[2010-12-09 11:37:39 UTC] felix wrote:
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?`.
[2010-12-16 15:40:58 UTC] alaric wrote:
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?
[2010-12-18 12:19:12 UTC] felix wrote:
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.
[2010-12-22 11:13:45 UTC] felix wrote:
The discussion period has ended. Please give your vote on the following change:
`equal?` be changed to not recurse into closure slots when comparing procedures?; Yes; No)]
[2011-01-02 11:32:35 UTC] felix changed status from new to closed
[2011-01-02 11:32:35 UTC] felix set resolution to fixed
[2011-01-02 11:32:35 UTC] felix wrote:
No rejections, so this appears to be accepted.
[2011-06-01 09:00:41 UTC] felix changed milestone from 4.7.0 to 4.8.0
[2011-06-01 09:00:41 UTC] felix wrote:
Milestone 4.7.0 deleted
[2012-09-24 21:47:48 UTC] felix changed milestone from 4.8.0 to 4.9.0
[2012-09-24 21:47:48 UTC] felix wrote:
Milestone 4.8.0 deleted