diff --git a/doc/ref/goops.texi b/doc/ref/goops.texi index fb90c8b68..6dcb74449 100644 --- a/doc/ref/goops.texi +++ b/doc/ref/goops.texi @@ -1270,8 +1270,8 @@ GOOPS equivalents --- to be obtained dynamically, at run time. @menu * Classes:: -* Slots:: * Instances:: +* Slots:: * Generic Functions:: @end menu @@ -1331,6 +1331,47 @@ Return a list of all methods that use @var{class} or a subclass of @end deffn +@node Instances +@subsection Instances + +@deffn {primitive procedure} class-of value +Return the GOOPS class of any Scheme @var{value}. +@end deffn + +@deffn {primitive procedure} instance? object +Return @code{#t} if @var{object} is any GOOPS instance, otherwise +@code{#f}. +@end deffn + +@deffn procedure is-a? object class +Return @code{#t} if @var{object} is an instance of @var{class} or one of +its subclasses. +@end deffn + +You can use the @code{is-a?} predicate to ask whether any given value +belongs to a given class, or @code{class-of} to discover the class of a +given value. Note that when GOOPS is loaded (by code using the +@code{(oop goops)} module) built-in classes like @code{}, +@code{} and @code{} are automatically set up, +corresponding to all Guile Scheme types. + +@lisp +(is-a? 2.3 ) @result{} #t +(is-a? 2.3 ) @result{} #t +(is-a? 2.3 ) @result{} #f +(is-a? '("a" "b") ) @result{} #f +(is-a? '("a" "b") ) @result{} #t +(is-a? (car '("a" "b")) ) @result{} #t +(is-a? ) @result{} #t +(is-a? ) @result{} #f + +(class-of 2.3) @result{} #< 908c708> +(class-of #(1 2 3)) @result{} #< 908cd20> +(class-of ) @result{} #< 8bd3e10> +(class-of ) @result{} #< 8bd3e10> +@end lisp + + @node Slots @subsection Slots @@ -1412,46 +1453,6 @@ method, so, in general, the function returned by see @ref{Slot Options,, init-value}. @end deffn -@node Instances -@subsection Instances - -@deffn {primitive procedure} class-of value -Return the GOOPS class of any Scheme @var{value}. -@end deffn - -@deffn {primitive procedure} instance? object -Return @code{#t} if @var{object} is any GOOPS instance, otherwise -@code{#f}. -@end deffn - -@deffn procedure is-a? object class -Return @code{#t} if @var{object} is an instance of @var{class} or one of -its subclasses. -@end deffn - -You can use the @code{is-a?} predicate to ask whether any given value -belongs to a given class, or @code{class-of} to discover the class of a -given value. Note that when GOOPS is loaded (by code using the -@code{(oop goops)} module) built-in classes like @code{}, -@code{} and @code{} are automatically set up, -corresponding to all Guile Scheme types. - -@lisp -(is-a? 2.3 ) @result{} #t -(is-a? 2.3 ) @result{} #t -(is-a? 2.3 ) @result{} #f -(is-a? '("a" "b") ) @result{} #f -(is-a? '("a" "b") ) @result{} #t -(is-a? (car '("a" "b")) ) @result{} #t -(is-a? ) @result{} #t -(is-a? ) @result{} #f - -(class-of 2.3) @result{} #< 908c708> -(class-of #(1 2 3)) @result{} #< 908cd20> -(class-of ) @result{} #< 8bd3e10> -(class-of ) @result{} #< 8bd3e10> -@end lisp - @node Generic Functions @subsection Generic Functions