Am So., 30. Okt. 2022 um 17:57 Uhr schrieb Marc Nieper-Wißkirchen
<[email protected]>:
>
> Am So., 30. Okt. 2022 um 17:37 Uhr schrieb John Cowan <[email protected]>:
> >
> >
> >
> > On Sun, Oct 30, 2022 at 5:09 AM Marc Nieper-Wißkirchen
> > <[email protected]> wrote:
> >
> >> 95% or more of the record-type definitions in practice are supposed to
> >> be nongenerative.
> >
> >
> > What is the evidence for this claim? As far as I know, almost all
> > record-type definitions are global, which means it makes no difference
> > whether they are generative or non-generative.
>
> Global record-type definitions are effectively non-generative.
>
> Local record-type definitions are helpful if one wants to use lexical
> scoping. If the type to be defined is only used locally in a
> procedure (which includes a macro transformer, for example), this can
> be good coding practice to prevent pollution of the (module-)global
> namespace. If these local record-type definitions were generative,
> the "good coding practice" would lead to inefficient code.
PS Due to phasing, record definitions that are used in macro expanders
have to be defined locally (unless one writes a helper library). E.g.:
(define-syntax foo
(lambda (stx)
(define-record-type ast
(nongenerative)
...)
...
(syntax-case stx ()
...))
We don't want that every invocation of the foo macro creates a new record type.
The small language would be lacking here.