DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

(guile.info.gz) Defining New Types (Smobs)

Info Catalog (guile.info.gz) How Guile does it (guile.info.gz) Data Representation
 
 18.3 Defining New Types (Smobs)
 ===============================
 
 "Smobs" are Guile's mechanism for adding new non-immediate types to the
 system.(1)  To define a new smob type, the programmer provides Guile
 with some essential information about the type -- how to print it, how
 to garbage collect it, and so on -- and Guile returns a fresh type tag
 for use in the first word of new cells.  The programmer can then use
 `scm_c_define_gsubr' to make a set of C functions that create and
 operate on these objects visible to Scheme code.
 
    (You can find a complete version of the example code used in this
 section in the Guile distribution, in `doc/example-smob'.  That
 directory includes a makefile and a suitable `main' function, so you
 can build a complete interactive Guile shell, extended with the
 datatypes described here.)
 

Menu

 
* Describing a New Type
* Creating Instances
* Type checking
* Garbage Collecting Smobs
* A Common Mistake In Allocating Smobs
* Garbage Collecting Simple Smobs
* A Complete Example
 
    ---------- Footnotes ----------
 
    (1) The term "smob" was coined by Aubrey Jaffer, who says it comes
 from "small object", referring to the fact that only the CDR and part
 of the CAR of a smob's cell are available for use.
 
Info Catalog (guile.info.gz) How Guile does it (guile.info.gz) Data Representation
automatically generated byinfo2html