unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: No Itisnt <theseaisinhere@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guile-devel@gnu.org
Subject: Re: Custom printers for SRFI-9 records
Date: Wed, 26 May 2010 21:41:31 -0500	[thread overview]
Message-ID: <AANLkTikMGUYP1hfvMhetxUXywCMsS4-uIihjJai7xwsV@mail.gmail.com> (raw)
In-Reply-To: <87d3wimgwo.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 505 bytes --]

OK.

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

How so? Two trailing spaces after the period or two newlines?
Is there a style guide somewhere? I was mainly copying and pasting
from srfi-modules.texi.

> 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
> modules/Makefile.am.

Done.

[-- Attachment #2: printers.patch --]
[-- Type: application/octet-stream, Size: 2425 bytes --]

diff --git a/doc/ref/srfi-modules.texi b/doc/ref/srfi-modules.texi
index b3f9946..08b11e0 100644
--- a/doc/ref/srfi-modules.texi
+++ b/doc/ref/srfi-modules.texi
@@ -1922,30 +1922,23 @@ 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.
 
-@menu
-* SRFI-9 Custom printers::      Customizing print behavior.
-@end menu
+@unnumberedsubsubsec Custom Printers
 
-@node SRFI-9 Custom printers
-@subsubsection Custom printers
-@cindex record printer
-
-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
+You may use @code{set-record-type-printer!} to customize the default printing
+behavior of records. This is a Guile extension and is not part of SRFI-9. It is
 located in the @nicode{(srfi srfi-9 gnu)} module.
 
-@deffn {library syntax} set-record-printer! name thunk
+@deffn {Scheme Syntax} set-record-type-printer! name thunk
 Where @var{type} corresponds to the first argument of @code{define-record-type},
 and @var{thunk} is a procedure accepting two arguments, the record to print, and
 an output port.
-
 @end deffn
 
 @noindent
-This example prints the employee's name in brackets, for instance ``@code{[Fred]}''.
+This example prints the employee's name in brackets, for instance @code{[Fred]}.
 
 @example
-(set-record-printer! employee-type
+(set-record-type-printer! employee-type
   (lambda (record port)
     (write-char #\[ port)
     (display (get-employee-name record) port)
diff --git a/module/Makefile.am b/module/Makefile.am
index 4ea8997..80376c9 100644
--- a/module/Makefile.am
+++ b/module/Makefile.am
@@ -236,6 +236,7 @@ SRFI_SOURCES = \
   srfi/srfi-6.scm \
   srfi/srfi-8.scm \
   srfi/srfi-9.scm \
+  srfi/srfi-9/gnu.scm \
   srfi/srfi-10.scm \
   srfi/srfi-11.scm \
   srfi/srfi-13.scm \
diff --git a/module/srfi/srfi-9/gnu.scm b/module/srfi/srfi-9/gnu.scm
index 3a37471..30c101b 100644
--- a/module/srfi/srfi-9/gnu.scm
+++ b/module/srfi/srfi-9/gnu.scm
@@ -23,7 +23,8 @@
 ;;; Code:
 
 (define-module (srfi srfi-9 gnu)
-  #:export (set-record-printer!))
+  #:export (set-record-type-printer!))
 
-(define (set-record-printer! type thunk)
+(define (set-record-type-printer! type thunk)
+  "Set a custom printer THUNK for TYPE."
   (struct-set! type vtable-index-printer thunk))

  reply	other threads:[~2010-05-27  2:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-25  0:26 Custom printers for SRFI-9 records No Itisnt
2010-05-25 19:23 ` Ludovic Courtès
     [not found]   ` <AANLkTilzb959cEaRDcpFUntPK_r0q_9RsIE5pByG4QPm@mail.gmail.com>
2010-05-26  4:18     ` No Itisnt
2010-05-26 21:09       ` No Itisnt
2010-05-26 22:04         ` Ludovic Courtès
2010-05-26 22:42         ` Ludovic Courtès
2010-05-26 22:34       ` Ludovic Courtès
2010-05-27  2:41         ` No Itisnt [this message]
2010-05-27  8:20           ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTikMGUYP1hfvMhetxUXywCMsS4-uIihjJai7xwsV@mail.gmail.com \
    --to=theseaisinhere@gmail.com \
    --cc=guile-devel@gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).