Re: rnrs records: shadows previous definition of `dummy-1a78708d3c9406a3'
Olivier Dion <[email protected]> Sun, 24 May 2026 18:12:20 -0400
| Newsgroups | gmane.lisp.guile.devel |
|---|---|
| Message-ID | <871pf0wj7f.fsf@laura> |
Thanks for the patch Tomas. I will try to review/merge it this week. On Sun, 24 May 2026, Tomas Volf <[email protected]> wrote: > Hello, > > Am=C3=A9lie 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 i= s, 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: =3D?UTF-8?q?Am=3DC3=3DA9lie=3D20Devos?=3D <[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-1a78708d= 3c9406a3' 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/synt= actic.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=20 > + (register-record-type > (quote record-name) > - record-name (make-record-constructor-descriptor= =20 > + 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) > --=20 > 2.54.0 > > > --=20 > There are only two hard things in Computer Science: > cache invalidation, naming things and off-by-one errors. --=20 Olivier Dion