Summary

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

Metadata

Attachments

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.

Changes and comments

[2014-08-22 02:19:23 UTC] acharlton attached srfi-99.patch (description=#f)

[2014-09-05 03:33:52 UTC] chust changed status from new to assigned

[2014-09-05 03:33:52 UTC] chust set owner to chust

[2014-09-05 03:33:52 UTC] chust wrote:

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.

[2014-09-05 16:00:25 UTC] chust changed status from assigned to closed

[2014-09-05 16:00:25 UTC] chust set resolution to fixed

[2014-09-05 16:00:25 UTC] chust wrote:

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