The procedures in this section provide means for constructing port types with standard and custom operations, and accessing their operations.
Creates and returns a new port type.
Operations must be a list; each element is a list of two elements,
the name of the operation (a symbol) and the procedure that implements
it. Port-type is either
#f or a port type; if it is a port
type, any operations implemented by port-type but not specified in
operations will be implemented by the resulting port type.
Operations need not contain definitions for all of the standard
operations; the procedure will provide defaults for any standard
operations that are not defined. At a minimum, the following operations
must be defined: for input ports,
for output ports, either
I/O ports must supply the minimum operations for both input and
If an operation in operations is defined to be
#f, then the
corresponding operation in port-type is not inherited.
read-char is defined in operations, then any standard
input operations defined in port-type are ignored. Likewise, if
write-substring is defined in
operations, then any standard output operations defined in
port-type are ignored. This feature allows overriding the
standard operations without having to enumerate them.
These predicates return
#t if object is a port type,
input-port type, output-port type, or I/O-port type,
respectively. Otherwise, they return
These procedures are deprecated; use the procedures defined above.