Ticket #441 (closed change request: fixed)

Opened 2 years ago

Last modified 8 months ago

equal? may not recurse into closures

Reported by: felix Owned by:
Priority: major Milestone: 4.9.0
Component: core libraries Version: 4.6.x
Keywords: equal? procedures Cc:

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

follow-up: ↓ 2   Changed 2 years ago by alaric

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?

in reply to: ↑ 1 ; follow-up: ↓ 3   Changed 2 years ago by 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?.

in reply to: ↑ 2 ; follow-up: ↓ 4   Changed 2 years ago by 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?

in reply to: ↑ 3   Changed 2 years ago by felix

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.

  Changed 2 years ago by felix

The discussion period has ended. Please give your vote on the following change:

Shall `equal?` be changed to not recurse into closure slots when comparing procedures?
  • Yes (alanpost, chust, ckeen, felix)
  • No

  Changed 2 years ago by felix

  • status changed from new to closed
  • resolution set to fixed

No rejections, so this appears to be accepted.

  Changed 2 years ago by felix

  • milestone changed from 4.7.0 to 4.8.0

Milestone 4.7.0 deleted

  Changed 8 months ago by felix

  • milestone changed from 4.8.0 to 4.9.0

Milestone 4.8.0 deleted

Note: See TracTickets for help on using tickets.