Next: descriptors compound, Previous: descriptors retrieving, Up: descriptors [Contents][Index]
Core object–type descriptors gather the run–time characteristics of
object–types like fixnums and strings; for every core object–type
there is an already defined type descriptor, bound to a syntactic
binding exported by the library (vicare system
type-descriptors)
.
Such syntactic bindings have name derived from the type name by
appending ‘-ctd’ (where ‘ctd’ stands for Core Type
Descriptor). So the type name <fixnum>
has the associated type
descriptor <fixnum>-ctd
, the type name <string>
has the
associated type descriptor <string>-ctd
, et cetera.
Some usage examples:
(import (only (vicare system type-descriptors) <string>-ctd)) (type-descriptor <string>) ⇒ <string>-ctd (.name <string>-ctd) ⇒ <string> (.parent <string>-ctd) ⇒ <top>-ctd (.uids-list <string>-ctd) ⇒ (vicare:core-type:<string> vicare:core-type:<top>) (let* ((retriever (.method-retriever <string>-ctd)) (strlen (retriever 'length))) (strlen "ciao")) ⇒ 4
The following syntactic bindings are exported by the library
(vicare system type-descriptors)
.
The type name of objects describing core object–types. It has the following immutable fields:
name
A symbol representing the name of this type. For example: ‘<string>’.
parent
If this type has a parent: an instance of <core-type-descriptor>
representing the parent of this type; otherwise #f
.
type-predicate
#f
or a function implementing the type predicate.
equality-predicate
#f
or a function implementing the equality predicate.
comparison-procedure
#f
or a function implementing the comparison procedure.
hash-function
#f
or a function implementing the hash function.
uids-list
A list of symbols representing the hierarchy of unique identifiers (UIDs) for this type. The first item in the list is the UID of this type, then the parent’s UID, then the grandparent’s UID, et cetera.
method-retriever
If this type has methods: a procedure to be applied to the method name
(a symbol) to retrieve the method implementation function; otherwise
#f
.
Return #t
if obj is an instance of
<core-type-descriptor>
; otherwise return #f
.
Accessors for the fields of <core-type-descriptor>
.
Return the UID of the core–type descriptor ctd.
Next: descriptors compound, Previous: descriptors retrieving, Up: descriptors [Contents][Index]