6.11 Object, Class, and Interface Utilities
Examples: | ||||||
|
Examples: | ||||||||
|
procedure
(interface? v) → boolean?
v : any/c
Examples: | ||||||
|
Examples: | |||||||||||||||
|
This procedure is similar in spirit to eq? but also works properly with contracts (and has a stronger guarantee).
Examples: | |||||||||||||||||||||||||
|
Examples: | ||||||
|
Added in version 6.1.1.8 of package base.
procedure
(object->vector object [opaque-v]) → vector?
object : object? opaque-v : any/c = #f
Examples: | |||||||
|
procedure
(class->interface class) → interface?
class : class?
Example: | ||
|
procedure
(object-interface object) → interface?
object : object?
Example: | ||
|
Examples: | |||||||||||||||||||||||
|
Examples: | ||||||
|
procedure
(implementation? v intf) → boolean?
v : any/c intf : interface?
Examples: | |||||||||||||||||
|
procedure
(interface-extension? v intf) → boolean?
v : any/c intf : interface?
Examples: | ||||||||||||||||
|
procedure
(method-in-interface? sym intf) → boolean?
sym : symbol? intf : interface?
Examples: | |||||||||
|
procedure
(interface->method-names intf) → (listof symbol?)
intf : interface?
Examples: | |||||||
|
procedure
(object-method-arity-includes? object sym cnt) → boolean? object : object? sym : symbol? cnt : exact-nonnegative-integer?
Examples: | |||||||||||||||||
|
procedure
(field-names object) → (listof symbol?)
object : object?
Examples: | ||||
|
procedure
(object-info object) →
(or/c class? #f) boolean? object : object?
class: a class or #f; the result is #f if the current inspector does not control any class for which the object is an instance.
skipped?: #f if the first result corresponds to the most specific class of object, #t otherwise.
procedure
(class-info class)
→
symbol? exact-nonnegative-integer? (listof symbol?) (any/c exact-nonnegative-integer? . -> . any/c) (any/c exact-nonnegative-integer? any/c . -> . any/c) (or/c class? #f) boolean? class : class?
name: the class’s name as a symbol;
field-cnt: the number of fields (public and private) defined by the class;
field-name-list: a list of symbols corresponding to the class’s public fields; this list can be larger than field-cnt because it includes inherited fields;
field-accessor: an accessor procedure for obtaining field values in instances of the class; the accessor takes an instance and a field index between 0 (inclusive) and field-cnt (exclusive);
field-mutator: a mutator procedure for modifying field values in instances of the class; the mutator takes an instance, a field index between 0 (inclusive) and field-cnt (exclusive), and a new field value;
super-class: a class for the most specific ancestor of the given class that is controlled by the current inspector, or #f if no ancestor is controlled by the current inspector;
skipped?: #f if the sixth result is the most specific ancestor class, #t otherwise.
struct
(struct exn:fail:object exn:fail () #:extra-constructor-name make-exn:fail:object)