Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 2bc72dd11ae49d1baca6e651a0d0b2cf > files > 12

guile-oops-1.0.2-1mdk.i586.rpm

This is release 1.0.2 of GOOPS, or
Guile Object Oriented Programming System.

Please send bug reports to bug-guile@gnu.org.

GOOPS is the object oriented extension to Guile. Its implementation is
derived from STk-3.99.3 by Erick Gallesio and version 1.3 of Gregor
Kiczales `Tiny-Clos'.  It is very close in spirit to CLOS, the Common
Lisp Object System (`CLtL2') but is adapted for the Scheme language.
While GOOPS is not compatible with any of these systems, GOOPS
contains a compatibility module which allows for execution of STKlos
programs.

Briefly stated, the GOOPS extension gives the user a full object
oriented system with multiple inheritance and generic functions with
multi-method dispatch.  Furthermore, the implementation relies on a
true meta object protocol, in the spirit of the one defined for CLOS
(Gregor Kiczales: A Metaobject Protocol).


Getting started ======================================================

[Most of this section can be found in the texinfo documentation as well.]

1. Make sure that you have a version of Guile later than or equal to
   1.3.2 and earlier than 1.5 installed on your system.  (You can type

     guile -c '(write-line (version))'

   in your terminal window to check which version of Guile you have.)
   If not, see under "Obtaining GOOPS" how to get it.

2. Make sure that you stand in the `guile-oops' directory and type

     ./configure

   This will configure GOOPS for your system.

3. Type

     make install

   to build and install GOOPS.

If everything went well we're ready to enter the interpreter:

4. Type

     guile-oops

   You should now be at the Guile prompt ("guile> ").

5. Type

     (use-modules (oop goops))

   to load GOOPS.  (If your system supports dynamic loading, you
   should be able to do this not only from `guile-oops' but from an
   arbitrary Guile interpreter.)

We're now ready to try some basic GOOPS functionality.

Generic functions

  (define-method (+ (x <string>) (y <string>))
    (string-append x y))

  (+ 1 2) --> 3
  (+ "abc" "de") --> "abcde"

User-defined types

  (define-class <2D-vector> ()
    (x #:init-value 0 #:accessor x-component #:init-keyword #:x)
    (y #:init-value 0 #:accessor y-component #:init-keyword #:y))

  (use-modules (ice-9 format))

  (define-method (write (obj <2D-vector>) port)
    (display (format #f "<~S, ~S>" (x-component obj) (y-component obj))
	     port))

  (define v (make <2D-vector> #:x 3 #:y 4))
  v --> <3, 4>

  (define-method (+ (x <2D-vector>) (y <2D-vector>))
    (make <2D-vector>
          #:x (+ (x-component x) (x-component y))
          #:y (+ (y-component x) (y-component y))))

  (+ v v) --> <6, 8>

Asking for the type of an object

  (class-of v) --> #<<class> <2D-vector> 40241ac0>
  <2D-vector>  --> #<<class> <2D-vector> 40241ac0>
  (class-of 1) --> #<<class> <integer> 401b2a98>
  <integer>    --> #<<class> <integer> 401b2a98>

  (is-a? v <2D-vector>) --> #t

See further in the GOOPS tutorial available in this distribution in
info (goops.info) and texinfo format.


Some words of caution ================================================

This is the first release of GOOPS.  It could also be the last, since
GOOPS has now been merged into Guile.

While the basic functionality won't change much in the future, the
MOP, more advanced features, and the internal representation will
continue to move.

The generic function application protocol is based upon an idea from
PCL: We only compute the applicable methods for a certain type
combination once, and then cache it.

Currently, only the cache lookup mechanism is purely implemented in C.
Most other parts have been prototyped in Scheme.  This means that
while GOOPS is extremely efficient when executing code many times, the
first pass through the code is slow.

NOTE: The generic function application MOP is not yet implemented, so
      it is not yet possible to customize the behaviour of GF
      application by specializing apply-generic to a GF class of your
      own making.

We're very interested in comments about how GOOPS performs in larger
projects.  If you have any, please feel welcome to write to
Mikael Djurfeldt <djurfeldt@nada.kth.se>.


Anonymous CVS Access and FTP snapshots ===============================

We make the developers' working Guile sources available via anonymous
CVS, and by nightly snapshots, accessible via FTP.  See the files
`ANON-CVS' and `SNAPSHOTS' for details.

If you would like to receive mail when people commit changes to the
Guile CVS repository, you can subscribe to guile-cvs@sourceware.cygnus.com
by sending a message to guile-cvs-subscribe@sourceware.cygnus.com.  Even
better, you can get daily digests of these commit messages by sending
a message to guile-cvs-digest-subscribe@sourceware.cygnus.com.

If you want to subscribe an e-mail address other than the one that
appears in your From: header, say foo@bar.com, send a mail note to
guile-cvs-subscribe-foo=bar.com@sourceware.cygnus.com.


Obtaining GOOPS ======================================================

The latest official GOOPS release is available via anonymous FTP from
ftp.gnu.org, as /pub/gnu/guile/guile-oops-1.0.2.tar.gz.

Via the web, that's:  ftp://ftp.gnu.org/pub/gnu/guile/guile-oops-1.0.2.tar.gz
For getit, that's:    ftp.gnu.org:/pub/gnu/guile/guile-oops-1.0.2.tar.gz

If you don't already have Guile 1.4 installed on your system, you
also need to download and install
ftp://ftp.gnu.org/pub/gnu/guile/guile-1.4.tar.gz

The mailing list `guile@sourceware.cygnus.com' carries discussions,
questions, and often answers, about Guile.  To subscribe, send mail to
guile-subscribe@sourceware.cygnus.com.  Of course, please send bug
reports (and fixes!) to bug-guile@gnu.org.  Note that one address is
@sourceware.cygnus.com, and the other is at @gnu.org.