Opened 5 years ago

Closed 5 years ago

#1151 closed defect (fixed)

srfi-99: define-record-type doesn't properly define field accessor when the field name matches a previously defined symbol

Reported by: acharlton Owned by: chust
Priority: minor Milestone: someday
Component: extensions Version: 4.9.x
Keywords: Cc:
Estimated difficulty:

Description

For example:

(define-record-type my-cons #t #t

kar cdr)

(my-cons-kar (make-my-cons 1 2))

will succeed, but:

(my-cons-cdr (make-my-cons 1 2))

will fail with

Error: unbound variable: my-cons-car

Since the my-cons-cdr accessor is defined with the syntax-alias of cdr (i.e. my-cons-cdrXXX is defined instead).

The attached patch fixes this.

Attachments (1)

srfi-99.patch (524 bytes) - added by acharlton 5 years ago.

Download all attachments as: .zip

Change History (3)

Changed 5 years ago by acharlton

comment:1 Changed 5 years ago by chust

  • Owner set to chust
  • Status changed from new to assigned

I can verify this problem, in fact the provided patch is somewhat incomplete — it fixes this particular instance of the problem while other uses of symbol-append in the code might suffer from analogous problematic behaviour.

All the expressions using symbol-append have been adapted accordingly in changeset 294ff6295b. I would appreciate it if you could test this, too, before I tag a new version of the egg.

comment:2 Changed 5 years ago by chust

  • Resolution set to fixed
  • Status changed from assigned to closed

The changes appear to work fine, version 1.4.2 of the egg has been tagged, which incorporates the fix.

Note: See TracTickets for help on using tickets.