Summary
srfi-99: define-record-type doesn't properly define field accessor when the field name matches a previously defined symbol
Metadata
- Id: 5923fba3aa1303034cf2caf6342815114335fc01
- Trac id: 1151
- Type: defect
- Reporter: acharlton
- Owner: chust
- Cc:
- Status: closed
- Component: extensions
- Estimated difficulty:
- Resolution: fixed
- Priority: minor
- Milestone: someday
- Version: 4.9.x
- Changetime: 2014-09-05 16:00:25 UTC
- Created: 2014-08-21 22:53:46 UTC
- Keywords:
Attachments
- 5923fba3aa1303034cf2caf6342815114335fc01/attachments/srfi-99.patch
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.