Two bugs in the SRFI-263 sample implementation
Derrell Piper 24 May 2026 14:50 UTC
Schemers,
While porting the SRFI-263 sample implementation to Chicken Scheme I hit two
issues.
(Reference: srfi-263/ subdirectory at
https://github.com/scheme-requests-for-implementation/srfi-263, master as
of 2026-05-23.)
1. delete-slot! calls set-parent-list! with one argument
---------------------------------------------------------
In srfi-263.impl.scm, in delete-slot!, the parent-list cleanup is:
(if (eq? 'parent (slot-type slot))
(set-parent-list! (delete (slot-getter slot) parent-list)))
set-parent-list! is the mutator generated by define-record-type for the
object-data record, so it takes (obj-data new-value) — two arguments.
The receiver obj-data is missing.
Under any Scheme that arity-checks record setters this raises at runtime
the first time a parent slot is deleted. Chicken's scrutinizer flagged
it at compile time:
Procedure `set-parent-list!' is called with 1 argument
but 2 arguments are expected.
Suggested fix:
(if (eq? 'parent (slot-type slot))
(set-parent-list! obj-data
(delete (slot-getter slot) parent-list)))
2. srfi-263-syntax library exports symbols the impl does not define
-------------------------------------------------------------------
srfi-263-syntax.scm declares:
(define-library (srfi 263 syntax)
(export define-method
clone-object
define-object)
(include "srfi-263-syntax.impl.scm"))
but srfi-263-syntax.impl.scm actually defines:
set-method! ; — not define-method
derive-object
copy-object ; — not clone-object
derive-object/add-slots!
define-object
So define-method and clone-object are exported names with no binding,
and the macros users actually want (set-method!, derive-object,
copy-object) are not exported at all. An R7RS define-library should
fail to load this.
Suggested fix: either rename the macros to match the declared exports,
or change the export list to match the actual macro names. The bodies
read fine; this looks like a stale export list from an earlier revision.
Aside: the body of test.scm exercises set-method! and derive-object
directly via the impl file include, so the test suite does not currently
detect the missing-export problem.
Derrell