DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

(guile.info.gz) Structure Concepts

Info Catalog (guile.info.gz) Structures (guile.info.gz) Structure Layout
 
 22.5.1 Structure Concepts
 -------------------------
 
 A structure object consists of a handle, structure data, and a vtable.
 The handle is a Scheme value which points to both the vtable and the
 structure's data.  Structure data is a dynamically allocated region of
 memory, private to the structure, divided up into typed fields.  A
 vtable is another structure used to hold type-specific data.  Multiple
 structures can share a common vtable.
 
    Three concepts are key to understanding structures.
 
    * "layout specifications"
 
      Layout specifications determine how memory allocated to structures
      is divided up into fields.  Programmers must write a layout
      specification whenever a new type of structure is defined.
 
    * "structural accessors"
 
      Structure access is by field number.   There is only one set of
      accessors common to all structure objects.
 
    * "vtables"
 
      Vtables, themselves structures, are first class representations of
      disjoint sub-types of structures in general.   In most cases, when
      a new structure is created, programmers must specify a vtable for
      the new structure.   Each vtable has a field describing the layout
      of its instances.   Vtables can have additional, user-defined
      fields as well.
 
Info Catalog (guile.info.gz) Structures (guile.info.gz) Structure Layout
automatically generated byinfo2html