#lang scribble/doc @; THIS FILE IS GENERATED @(require scribble/manual) @(require (for-label (planet neil/srfi-9-plus:1:0))) @title[#:version "0.1"]{@bold{srfi-9-plus}: Enhanced define-record-type in PLT Scheme} @author{Neil Van Dyke} License: @seclink["Legal" #:underline? #f]{LGPL 3} @(hspace 1) Web: @link["http://www.neilvandyke.org/srfi-9-plus/" #:underline? #f]{http://www.neilvandyke.org/srfi-9-plus/} @defmodule[(planet neil/srfi-9-plus:1:0)] @section{Introduction} The @bold{srfi-9-plus} library (almost completely) implements @link["http://srfi.schemers.org/srfi-9/srfi-9.html"]{SRFI-9}, and adds a @tt{define-record-type/write} syntax that is like @tt{define-record-type} but extended to define a custom writer. This library does not completely implement SRFI-9 in that the @tt{define-record-type} defined here requires that the sequence of field tags in the constructor match the initial sequence of field tags defined by the field specs. That feature of SRFI-9 should not be necessary, since the field specs can be ordered to match the desired constructor arguments. This library was written for adding custom writing to some code that was implemented using SRFI-9, rather than rework that code to use @tt{define-record-type} directly. @bold{srfi-9-plus} is currently implemented for PLT Scheme as a veneer over @tt{make-struct-type}, although that is not guaranteed. This documentation was written quickly. @section{Interface} @defform[#:id define-record-type/write (define-record-type/write type constructor-spec predicate write-proc field-specs ...)]{ This is like SRFI-9 @tt{define-record-type}, except for the extra @schemevarfont{write-proc} form, which is a PLT @tt{struct} @tt{prop:custom-write} procedure. For example: @SCHEMEBLOCK[ (define (foo-write-proc record port write?) (and write? (display "<<>>" port))) (define-record-type/write foo (make-foo aaa bbb) foo? foo-write-proc (aaa foo:aaa) (bbb foo:bbb foo:set-bbb!) (ccc foo:ccc)) (define x (make-foo 0 60)) x ==> <<>> (format "~A" x) ==> "0 to 60" ] } @defform[#:id define-record-type (define-record-type type constructor-spec predicate field-specs ...)]{ This is like the SRFI-9 syntax of the same name. } @section{History} @itemize[ @item{Version 0.1 --- 2009-11-28 --- PLaneT @tt{(1 0)} Initial version. Tested lightly. } ] @section[#:tag "Legal"]{Legal} Copyright (c) 2009 Neil Van Dyke. This program is Software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License (LGPL 3), or (at your option) any later version. This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See http://www.gnu.org/licenses/ for details. For other licenses and consulting, please contact the author.