[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.11 Miscellaneous Functions

2.11.1 Administration Functions  
2.11.2 Error Handling  
2.11.3 Object Comparisons  
2.11.4 Cloning Objects  
2.11.5 Write and Display  


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.11.1 Administration Functions

This section describes administrative, non-technical GOOPS functions.

primitive: goops-version
Return the current GOOPS version as a string, for example "0.2".


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.11.2 Error Handling

The procedure goops-error is called to raise an appropriate error by the default methods of the following generic functions:

If you customize these functions for particular classes or metaclasses, you may still want to use goops-error to signal any error conditions that you detect.

procedure: goops-error format-string . args
Raise an error with key goops-error and error message constructed from format-string and args. Error message formatting is as done by scm-error.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.11.3 Object Comparisons

generic: object-eqv?
method: object-eqv? ((x <top>) (y <top>))
generic: object-equal?
method: object-equal? ((x <top>) (y <top>))
Generic functions and default (unspecialized) methods for comparing two GOOPS objects.

The default methods always return #f. Application class authors may wish to define specialized methods for object-eqv? and object-equal? that compare instances of the same class for equality in whatever sense is useful to the application.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.11.4 Cloning Objects

generic: shallow-clone
method: shallow-clone (self <object>)
Return a "shallow" clone of self. The default method makes a shallow clone by allocating a new instance and copying slot values from self to the new instance. Each slot value is copied either as an immediate value or by reference.

generic: deep-clone
method: deep-clone (self <object>)
Return a "deep" clone of self. The default method makes a deep clone by allocating a new instance and copying or cloning slot values from self to the new instance. If a slot value is an instance (satisfies instance?), it is cloned by calling deep-clone on that value. Other slot values are copied either as immediate values or by reference.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.11.5 Write and Display

primitive generic: write object port
primitive generic: display object port
When GOOPS is loaded, write and display become generic functions with special methods for printing

write and display print non-GOOPS values in the same way as the Guile primitive write and display functions.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3. MOP Specification

For an introduction to metaobjects and the metaobject protocol, see 2.1.1 Metaobjects and the Metaobject Protocol.

The aim of the MOP specification in this chapter is to specify all the customizable generic function invocations that can be made by the standard GOOPS syntax, procedures and methods, and to explain the protocol for customizing such invocations.

A generic function invocation is customizable if the types of the arguments to which it is applied are not all determined by the lexical context in which the invocation appears. For example,

When using this rule to decide whether a given generic function invocation is customizable, we ignore arguments that are expected to be handled in method definitions as a single "rest" list argument.

For each customizable generic function invocation, the invocation protocol is explained by specifying

3.1 Class Definition  
3.2 Instance Creation  
3.3 Class Redefinition  
3.4 Method Definition  
3.5 Generic Function Invocation  


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by Ingo Ruhnke on September, 12 2002 using texi2html