Opened 10 years ago

Closed 10 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: Thomas 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 10 years ago.

Download all attachments as: .zip

Change History (3)

Changed 10 years ago by acharlton

Attachment: srfi-99.patch added

comment:1 Changed 10 years ago by Thomas Chust

Owner: set to Thomas Chust
Status: newassigned

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 10 years ago by Thomas Chust

Resolution: fixed
Status: assignedclosed

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.