DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(goops.info.gz) Extending Guiles Primitives

Info Catalog (goops.info.gz) Generic Function Internals (goops.info.gz) Creating Generic Functions
 
 Extending Guile's Primitives
 ----------------------------
 
 When GOOPS is loaded, many of Guile's primitive procedures can be
 extended by giving them a generic function definition that operates in
 conjunction with their normal C-coded implementation.  For primitives
 that are extended in this way, the result from the user- or
 application-level point of view is that the extended primitive behaves
 exactly like a generic function with the C-coded implementation as its
 default method.
 
 The `generic-capability?' predicate should be used to determine whether
 a particular primitive is extensible in this way.
 
  - primitive procedure: generic-capability? primitive
      Return `#t' if PRIMITIVE can be extended by giving it a generic
      function definition, otherwise `#f'.
 
 Even when a primitive procedure is extensible like this, its generic
 function definition is not created until it is needed by a call to
 `define-method', or until the application explicitly requests it by
 calling `enable-primitive-generic!'.
 
  - primitive procedure: enable-primitive-generic! primitive
      Force the creation of a generic function definition for PRIMITIVE.
 
 Once the generic function definition for a primitive has been created,
 it can be retrieved using `primitive-generic-generic'.
 
  - primitive procedure: primitive-generic-generic primitive
      Return the generic function definition of PRIMITIVE.
 
      `primitive-generic-generic' raises an error if PRIMITIVE is not a
      primitive with generic capability, or if its generic capability
      has not yet been enabled, whether implicitly (by `define-method')
      or explicitly (by `enable-primitive-generic!').
 
 Note that the distinction between, on the one hand, primitives with
 additional generic function definitions and, on the other hand, generic
 functions with a default method, may disappear when GOOPS is fully
 integrated into the core of Guile.  Consequently, the procedures
 described in this section may disappear as well.
 
Info Catalog (goops.info.gz) Generic Function Internals (goops.info.gz) Creating Generic Functions
automatically generated byinfo2html