[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom printers for SRFI-9 records

From: Ludovic Courtès
Subject: Re: Custom printers for SRFI-9 records
Date: Thu, 27 May 2010 00:34:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)


No Itisnt <address@hidden> writes:

> On Tue, May 25, 2010 at 3:56 PM, No Itisnt <address@hidden> wrote:
>> I agree. Here's a patch that adds (srfi srfi-9 gnu) with
>> set-record-printer! and adds a subsection to the SRFI-9 part of the
>> manual for it.
>> I can go ahead and commit it, if that's OK.

This looks good to me.

> diff --git a/doc/ref/srfi-modules.texi b/doc/ref/srfi-modules.texi
> index 0d192fa..b3f9946 100644
> --- a/doc/ref/srfi-modules.texi
> +++ b/doc/ref/srfi-modules.texi
> @@ -1922,6 +1922,35 @@ The functions created by @code{define-record-type} are 
> ordinary
>  top-level @code{define}s.  They can be redefined or @code{set!} as
>  desired, exported from a module, etc.
> address@hidden
> +* SRFI-9 Custom printers::      Customizing print behavior.
> address@hidden menu
> +
> address@hidden SRFI-9 Custom printers
> address@hidden Custom printers

Use @unnumberedsubsubsec instead and no menu.  Capitalize like this:
“SRFI-9 Custom Printers”.

> +You may use @code{set-record-printer!} to customize the default printing
> +behavior of records. This is a GUILE extension and is not part of SRFI-9. It 
> is

s/GUILE/Guile/ and two spaces after and end-of-sentence period.

> +located in the @nicode{(srfi srfi-9 gnu)} module.
> +
> address@hidden {library syntax} set-record-printer! name thunk

Rather use @deffn{Scheme Syntax}, which seems to be the most commonly
used form in the manual.

> +This example prints the employee's name in brackets, for instance 
> address@hidden''.

No need for ``quotes'' here.

> +(define (set-record-printer! type thunk)
> +  (struct-set! type vtable-index-printer thunk))

I’d rather call it ‘set-record-type-printer!’ (it prints records, but
it’s the printer of the record type).  What do you think?

You could add a docstring here.

And don’t forget to add srfi-9/gnu.scm to ‘SRFI_SOURCES’ in


reply via email to

[Prev in Thread] Current Thread [Next in Thread]