Hello, Amélie Devos <[email protected]> writes:
> On 23/05/2026 3:21, Olivier Dion wrote: >> I have no idea why `dummy' is necessary here. I'm sure someone that > > To keep things in a definition context, or whatever the technical term is, I'd > assume. > > Going only by the code mentioned in the mail, It seems eliminatable > though. [..] I took the liberty to implement your suggestion and attach it to this email. Seems to work fine and no warnings are produced. This type of change hopefully is fine even for patch release, since relying on dummy-1a78708d3c9406a3 being defined by define-record-type has to be in the "not supported" territory, right?
>From 9db5c76701cecab240bf0eee0fea384b8e80c67d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Am=C3=A9lie=20Devos?= <[email protected]> Date: Sun, 24 May 2026 16:12:54 +0000 Subject: [PATCH] Adjust R6RS `define-record-type' to suppress shadowing warning. Given (use-modules (rnrs records syntactic)) (define-record-type a) (define-record-type b) shadowing warning was produced $ guild compile -Wshadowed-toplevel -o test.go test.scm test.scm:4:0: warning: shadows previous definition of `dummy-1a78708d3c9406a3' at test.scm:3:0 wrote `test.go' Since the `dummy' binding is not used by anything, solution is to not just produce it. --- module/rnrs/records/syntactic.scm | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/module/rnrs/records/syntactic.scm b/module/rnrs/records/syntactic.scm index bde6f9348..a4c7c1f29 100644 --- a/module/rnrs/records/syntactic.scm +++ b/module/rnrs/records/syntactic.scm @@ -173,14 +173,13 @@ (record-constructor (make-record-constructor-descriptor record-name #,parent-cd #,protocol))) - (define dummy + (define predicate-name (let () - (register-record-type + (register-record-type (quote record-name) - record-name (make-record-constructor-descriptor + record-name (make-record-constructor-descriptor record-name #,parent-cd #,protocol)) - 'dummy)) - (define predicate-name (record-predicate record-name)) + (record-predicate record-name))) #,@field-accessors #,@field-mutators))] [((fields record-fields ...) . rest) -- 2.54.0
-- There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.
