This site is a static rendering of the Trac instance that was used by R7RS-WG1 for its work on R7RS-small (PDF), which was ratified in 2013. For more information, see Home.

Ticket 171: Duplicate identifiers in define-record-type

2012-10-08 00:06:41
WG1 - Core
alexshinn
major
arcfide
fixed
source
closed
2011-05-05 23:01:44
defect

What happens if define-record-type is specified with two fields that have the same accessor identifiers provided for both fields? More generally, we need to say what happens when any two identifiers are non-unique.

This ticket deals specifically with the situation where two identifiers (accessors or mutators) of two field clauses in a define-record-type form are identical. This is not meant to address field names and what happens or what it means if the field names are symbolically equivalent but lexically distinct.

descriptionWhat happens if `define-record-type` is specified with two fields that have the same `accessor` identifiers provided for both fields?What happens if `define-record-type` is specified with two fields that have the same `accessor` identifiers provided for both fields? More generally, we need to say what happens when any two identifiers are non-unique.
descriptionWhat happens if `define-record-type` is specified with two fields that have the same `accessor` identifiers provided for both fields? More generally, we need to say what happens when any two identifiers are non-unique.What happens if `define-record-type` is specified with two fields that have the same `accessor` identifiers provided for both fields? More generally, we need to say what happens when any two identifiers are non-unique. This ticket deals specifically with the situation where two accessors that are the exact same identifiers are used. This is not meant to address field names and what happens or what it means if the field names are symbolically equivalent but lexically distinct.

Why is this restricted to accessors when its title speaks of identifiers generally? Surely the same issue arises with conflicts between modifiers, or between an accessor and a modifier.

descriptionWhat happens if `define-record-type` is specified with two fields that have the same `accessor` identifiers provided for both fields? More generally, we need to say what happens when any two identifiers are non-unique. This ticket deals specifically with the situation where two accessors that are the exact same identifiers are used. This is not meant to address field names and what happens or what it means if the field names are symbolically equivalent but lexically distinct.What happens if `define-record-type` is specified with two fields that have the same `accessor` identifiers provided for both fields? More generally, we need to say what happens when any two identifiers are non-unique. This ticket deals specifically with the situation where two identifiers (accessors or mutators) of two field clauses in a `define-record-type` form are identical. This is not meant to address field names and what happens or what it means if the field names are symbolically equivalent but lexically distinct.

I have adjusted the language to allow for both accessors and mutators. What I wanted to distinguish was the issue where you want to bind two different procedures to the same name, and where you have two field names that were the same, which shouldn't cause a problem since they are not used anywhere.

where you have two field names that were the same, which shouldn't cause a problem since they are not used anywhere

This is JUST WRONG, and has been corrected repeatedly. Field names are used in the definition of a SRFI 9 constructor. Consider this:

(define-record-type :pare (kons x x) pare? (x kar set-kar!) (x kdr))

Which argument of kons is identified with which field? Field types have to be distinct identifiers (not merely distinct symbols), though technically they don't have to be distinct from accessor/modifier names.

Okay, technically only the ones used in the constructor have to be distinct.

resolution
statusnewdecided

We voted to make this an error.

statusdecidedwriting

Field names have to be distinct, and so do mutator/accessor names.

resolutionfixed
statuswritingclosed