Next: syntaxes predicates, Previous: syntaxes define, Up: syntaxes [Contents][Index]
The syntaxes new
and delete
allow us to retrieve the
constructor and destructor functions of Scheme objects of some types.
For example, with records:
(define-record-type duo (fields one two) (destructor-protocol (lambda () (lambda (self) (fprintf (current-error-port) "destroying ~s\n" self))))) (define O (new duo 1 2)) (delete O) -| destroying #[record duo one=1 two=2]
The following syntactic bindings are exported by the library
(vicare)
.
Retrieve the default constructor function of the type type-name and apply it to the given arguments; return the result of the application.
Retrieve the destructor function, if any, of the object returned by the evaluation of the expression ?expr and apply it to the object; return the return value of the application. The evaluation of ?expr must return a single return value.
If the object has no destructor function: an exception is raised.
The destructor function must return zero values.