1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

Move Accessing Slots' inside Introspection'.

* doc/ref/goops.texi (Introspection): Move `Accessing Slots' into
  here, and flatten it, except for `Handling Slot Access Errors'.
  (GOOPS Error Handling): Move `Handling Slot Access Errors' here.
This commit is contained in:
Neil Jerram 2011-01-14 20:06:34 +00:00
parent c7b154588b
commit 3617da95ab

View file

@ -46,7 +46,6 @@ module. You can do this at the Guile REPL by evaluating:
* Inheritance:: * Inheritance::
* Introspection:: * Introspection::
* Class Options:: * Class Options::
* Accessing Slots::
* Generic Functions and Accessors:: * Generic Functions and Accessors::
* Redefining a Class:: * Redefining a Class::
* Changing the Class of an Instance:: * Changing the Class of an Instance::
@ -1273,6 +1272,7 @@ GOOPS equivalents --- to be obtained dynamically, at run time.
* Instances:: * Instances::
* Slots:: * Slots::
* Generic Functions:: * Generic Functions::
* Accessing Slots::
@end menu @end menu
@node Classes @node Classes
@ -1508,40 +1508,8 @@ Return an expression that prints to show the definition of method
@end deffn @end deffn
@node Class Options
@section Class Options
@deffn {class option} #:metaclass metaclass
The @code{#:metaclass} class option specifies the metaclass of the class
being defined. @var{metaclass} must be a class that inherits from
@code{<class>}. For the use of metaclasses, see @ref{Metaobjects and
the Metaobject Protocol} and @ref{Terminology}.
If the @code{#:metaclass} option is absent, GOOPS reuses or constructs a
metaclass for the new class by calling @code{ensure-metaclass}
(@pxref{Class Definition Internals,, ensure-metaclass}).
@end deffn
@deffn {class option} #:name name
The @code{#:name} class option specifies the new class's name. This
name is used to identify the class whenever related objects - the class
itself, its instances and its subclasses - are printed.
If the @code{#:name} option is absent, GOOPS uses the first argument to
@code{define-class} as the class name.
@end deffn
@node Accessing Slots @node Accessing Slots
@section Accessing Slots @subsection Accessing Slots
@menu
* Instance Slots::
* Class Slots::
* Handling Slot Access Errors::
@end menu
@node Instance Slots
@subsection Instance Slots
Any slot, regardless of its allocation, can be queried, referenced and Any slot, regardless of its allocation, can be queried, referenced and
set using the following four primitive procedures. set using the following four primitive procedures.
@ -1633,9 +1601,6 @@ slot called @var{slot-name} (@pxref{Handling Slot Access Errors,
slot-missing}). slot-missing}).
@end deffn @end deffn
@node Class Slots
@subsection Class Slots
Slots whose allocation is per-class rather than per-instance can be Slots whose allocation is per-class rather than per-instance can be
referenced and set without needing to specify any particular instance. referenced and set without needing to specify any particular instance.
@ -1661,37 +1626,31 @@ allocation, @code{class-slot-ref} calls the @code{slot-missing} generic
function with arguments @var{class} and @var{slot-name}. function with arguments @var{class} and @var{slot-name}.
@end deffn @end deffn
@node Handling Slot Access Errors
@subsection Handling Slot Access Errors
GOOPS calls one of the following generic functions when a ``slot-ref'' @node Class Options
or ``slot-set!'' call specifies a non-existent slot name, or tries to @section Class Options
reference a slot whose value is unbound.
@deffn generic slot-missing @deffn {class option} #:metaclass metaclass
@deffnx method slot-missing (class <class>) slot-name The @code{#:metaclass} class option specifies the metaclass of the class
@deffnx method slot-missing (class <class>) (object <object>) slot-name being defined. @var{metaclass} must be a class that inherits from
@deffnx method slot-missing (class <class>) (object <object>) slot-name value @code{<class>}. For the use of metaclasses, see @ref{Metaobjects and
When an application attempts to reference or set a class or instance the Metaobject Protocol} and @ref{Terminology}.
slot by name, and the slot name is invalid for the specified @var{class}
or @var{object}, GOOPS calls the @code{slot-missing} generic function.
The default methods all call @code{goops-error} with an appropriate If the @code{#:metaclass} option is absent, GOOPS reuses or constructs a
message. metaclass for the new class by calling @code{ensure-metaclass}
(@pxref{Class Definition Internals,, ensure-metaclass}).
@end deffn @end deffn
@deffn generic slot-unbound @deffn {class option} #:name name
@deffnx method slot-unbound (object <object>) The @code{#:name} class option specifies the new class's name. This
@deffnx method slot-unbound (class <class>) slot-name name is used to identify the class whenever related objects - the class
@deffnx method slot-unbound (class <class>) (object <object>) slot-name itself, its instances and its subclasses - are printed.
When an application attempts to reference a class or instance slot, and
the slot's value is unbound, GOOPS calls the @code{slot-unbound} generic
function.
The default methods all call @code{goops-error} with an appropriate If the @code{#:name} option is absent, GOOPS uses the first argument to
message. @code{define-class} as the class name.
@end deffn @end deffn
@node Generic Functions and Accessors @node Generic Functions and Accessors
@section Generic Functions and Accessors @section Generic Functions and Accessors
@ -1942,6 +1901,42 @@ from @var{format-string} and @var{args}. Error message formatting is
as done by @code{scm-error}. as done by @code{scm-error}.
@end deffn @end deffn
@menu
* Handling Slot Access Errors::
@end menu
@node Handling Slot Access Errors
@subsection Handling Slot Access Errors
GOOPS calls one of the following generic functions when a ``slot-ref''
or ``slot-set!'' call specifies a non-existent slot name, or tries to
reference a slot whose value is unbound.
@deffn generic slot-missing
@deffnx method slot-missing (class <class>) slot-name
@deffnx method slot-missing (class <class>) (object <object>) slot-name
@deffnx method slot-missing (class <class>) (object <object>) slot-name value
When an application attempts to reference or set a class or instance
slot by name, and the slot name is invalid for the specified @var{class}
or @var{object}, GOOPS calls the @code{slot-missing} generic function.
The default methods all call @code{goops-error} with an appropriate
message.
@end deffn
@deffn generic slot-unbound
@deffnx method slot-unbound (object <object>)
@deffnx method slot-unbound (class <class>) slot-name
@deffnx method slot-unbound (class <class>) (object <object>) slot-name
When an application attempts to reference a class or instance slot, and
the slot's value is unbound, GOOPS calls the @code{slot-unbound} generic
function.
The default methods all call @code{goops-error} with an appropriate
message.
@end deffn
@node Object Comparisons @node Object Comparisons
@section Object Comparisons @section Object Comparisons