Node:Unpacking the SCM type, Previous:Signalling Type Errors, Up:How Guile does it



18.2.7 Unpacking the SCM Type

The previous sections have explained how SCM values can refer to immediate and non-immediate Scheme objects. For immediate objects, the complete object value is stored in the SCM word itself, while for non-immediates, the SCM word contains a pointer to a heap cell, and further information about the object in question is stored in that cell. This section describes how the SCM type is actually represented and used at the C level.

In fact, there are two basic C data types to represent objects in Guile:

SCM Data type
SCM is the user level abstract C type that is used to represent all of Guile's Scheme objects, no matter what the Scheme object type is. No C operation except assignment is guaranteed to work with variables of type SCM, so you should only use macros and functions to work with SCM values. Values are converted between C data types and the SCM type with utility functions and macros.

scm_t_bits Data type
scm_t_bits is an integral data type that is guaranteed to be large enough to hold all information that is required to represent any Scheme object. While this data type is mostly used to implement Guile's internals, the use of this type is also necessary to write certain kinds of extensions to Guile.