Opened 6 years ago

Closed 4 years ago

#171 closed defect (fixed)

Duplicate identifiers in define-record-type

Reported by: arcfide Owned by: alexshinn
Priority: major Milestone:
Component: WG1 - Core Keywords:
Cc:

Description (last modified by arcfide)

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.

Change History (10)

comment:1 Changed 6 years ago by cowan

  • Description modified (diff)

comment:2 Changed 6 years ago by arcfide

  • Description modified (diff)

comment:3 Changed 6 years ago by cowan

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.

comment:4 Changed 6 years ago by arcfide

  • Description modified (diff)

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.

comment:5 Changed 6 years ago by cowan

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.

comment:6 Changed 6 years ago by cowan

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

comment:7 Changed 6 years ago by alexshinn

  • Status changed from new to decided

We voted to make this an error.

comment:8 Changed 6 years ago by alexshinn

  • Status changed from decided to writing

comment:9 Changed 4 years ago by cowan

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

comment:10 Changed 4 years ago by cowan

  • Resolution set to fixed
  • Status changed from writing to closed
Note: See TracTickets for help on using tickets.