1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-12 06:41:13 +02:00

Misc GOOPS chapter updates

* doc/ref/goops-tutorial.texi: Update intro text.  Fix `an' typo.

* doc/ref/goops.texi: Update quick start intro text.  Simplify
  example that uses `format'.
This commit is contained in:
Neil Jerram 2009-08-09 15:01:59 +01:00
parent 8d9cb14e61
commit 3d8e6eb82e
2 changed files with 6 additions and 7 deletions

View file

@ -30,9 +30,9 @@
@c Guile @c Guile
@c @end macro @c @end macro
This tutorial introduces the @goops{} package. It was originally This section introduces the @goops{} package in more detail. It was
written by Erick Gallesio as an appendix for the STk reference manual, originally written by Erick Gallesio as an appendix for the STk
and subsequently adapted to @goops{}. reference manual, and subsequently adapted to @goops{}.
The procedures and syntax described in this tutorial are provided by The procedures and syntax described in this tutorial are provided by
Guile modules that may need to be imported before being available. Guile modules that may need to be imported before being available.
@ -109,7 +109,7 @@ example.} This can be done with the following class definition:
@end lisp @end lisp
This binds the variable @code{<my-complex>} to a new class whose This binds the variable @code{<my-complex>} to a new class whose
instances will contain two slots. These slots are called @code{r} an instances will contain two slots. These slots are called @code{r} and
@code{i} and will hold the real and imaginary parts of a complex @code{i} and will hold the real and imaginary parts of a complex
number. Note that this class inherits from @code{<number>}, which is a number. Note that this class inherits from @code{<number>}, which is a
predefined class.@footnote{@code{<number>} is the direct superclass of predefined class.@footnote{@code{<number>} is the direct superclass of

View file

@ -40,7 +40,7 @@ meta object protocol, in the spirit of the one defined for CLOS
@section Quick Start @section Quick Start
To give an immediate flavour of what GOOPS can do, here is a very To give an immediate flavour of what GOOPS can do, here is a very
quick introduction to its main operations. brief introduction to its main operations.
To start using GOOPS, load the @code{(oop goops)} module: To start using GOOPS, load the @code{(oop goops)} module:
@ -89,8 +89,7 @@ types, Guile falls back to using the normal Scheme @code{+} procedure.
(use-modules (ice-9 format)) (use-modules (ice-9 format))
(define-method (write (obj <2D-vector>) port) (define-method (write (obj <2D-vector>) port)
(display (format #f "<~S, ~S>" (x-component obj) (y-component obj)) (format port "<~S, ~S>" (x-component obj) (y-component obj)))
port))
(define v (make <2D-vector> #:x 3 #:y 4)) (define v (make <2D-vector> #:x 3 #:y 4))