| | | print-object-for-saving/sending | |
print-object-for-saving/sending | | object stream
=> object | [Generic Function]
|
Purpose
Write the printed representation of object to
stream when saving or sending.
Method signatures
print-object-for-saving/sending | |
( object array)
stream
=> object
|
print-object-for-saving/sending | |
( object bit-vector)
stream
=> object
|
print-object-for-saving/sending | |
( object cons)
stream
=> object
|
print-object-for-saving/sending | |
( object function)
stream
=> object
|
print-object-for-saving/sending | |
( object generic-function)
stream
=> object
|
print-object-for-saving/sending | |
( object hash-table)
stream
=> object
|
print-object-for-saving/sending | |
( object package)
stream
=> object
|
print-object-for-saving/sending | |
( object standard-class)
stream
=> object
|
print-object-for-saving/sending | |
( object standard-generic-function)
stream
=> object
|
print-object-for-saving/sending | |
( object standard-object)
stream
=> object
|
print-object-for-saving/sending | |
( object standard-unit-instance)
stream
=> object
|
print-object-for-saving/sending | |
( object string)
stream
=> object
|
print-object-for-saving/sending | |
( object structure-object)
stream
=> object
|
print-object-for-saving/sending | |
( object vector)
stream
=> object
|
print-object-for-saving/sending | |
( object t)
stream
=> object
|
Package :gbbopen-tools
Module :gbbopen-tools
(the unit-instance method is added by
:gbbopen-core
)
Arguments and values
object | | An object
|
stream | | A stream
|
Returns
The object.
Errors
A call to print-object-for-saving/sending was made outside the
dynamic scope of a with-saving/sending-block.
See also
*print-object-for-sending*
omitted-slots-for-saving/sending
print-slot-for-saving/sending
save-blackboard-repository
with-saving/sending-block
Example
Define a method to save/send compiled-function references,
when possible:
(defmethod print-object-for-saving/sending ((fn function)
stream)
(flet ((save/send-error ()
(let ((*print-readably* nil))
(error "Unable to save/send ~s reliably." fn))))
(typecase fn
(compiled-function
(multiple-value-bind (lambda-expression closure-p name)
(function-lambda-expression fn)
(declare (ignore lambda-expression)
#+(or cmu sbcl)
(ignore closure-p))
(when (or
;; CMUCL and SBCL always return that
;; closure-p is true, so we ignore their
;; closure-p value and risk that `fn' might
;; be a non-trivial closure that can't be
;; represented externally:
#-(or cmu sbcl)
closure-p
;; Implementations are free to always return
;; nil as name or return an object that is
;; not valid for use as a name in function.
;; Fortunately, implementations usually
;; provide a useful name value:
(not (symbolp name))
(not name))
(save/send-error))
(format stream "#'~s" name)))
(otherwise (save/send-error))))
fn)
Note that the above method is not without risk, but it will work in
many situations.
The GBBopen Project
| | | print-object-for-saving/sending | |