The serializable-object Reference Manual

This is the serializable-object Reference Manual, version 0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sat Dec 03 23:15:18 2022 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 serializable-object

Provides a simple class and API for the objects serializable in a FASL file

Author

Masataro Asai

Contact

License

LGPL

Version

0.1

Dependency

alexandria (system).

Source

serializable-object.asd.

Child Component

package.lisp (file).


3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 serializable-object/serializable-object.asd

Source

serializable-object.asd.

Parent Component

serializable-object (system).

ASDF Systems

serializable-object.


3.1.2 serializable-object/package.lisp

Source

serializable-object.asd.

Parent Component

serializable-object (system).

Packages

serializable-object.

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 serializable-object

Source

package.lisp.

Use List
  • alexandria.
  • common-lisp.
Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Ordinary functions

Function: load-instance (pathname &rest args &key class if-does-not-exist verbose &allow-other-keys)

Load an instance from PATHNAME which was used when the object was saved.
The loaded instance should be of type CLASS.

+ When VERBOSE is non-nil, it writes messages to the standard output.

+ When IF-DOES-NOT-EXIST is :error (default), it signals an error when the file is missing.

+ When IF-DOES-NOT-EXIST is nil and the file does not exist, it calls
MAKE-INSTANCE with CLASS, with :pathname parameter and other parameters
specified in ARGS except :if-does-not-exist, :class, :verbose.

Package

serializable-object.

Source

package.lisp.


5.1.2 Generic functions

Generic Function: save (instance &key pathname store verbose parents compression overwrite &allow-other-keys)

Save an instance to a FASL file using the value of PATHNAME slot in the instance.
When PATHNAME is given as an argument,

+ the object is stored in the file specified by PATHNAME,
+ the slot value is _temporarily_ set to this value while saving the instance,
+ and the value of PATHNAME is used to save the PATHNAME slot in the saved object.

If STORE is non-nil when PATHNAME is given, PATHNAME also overwrites the slot value in the runtime object. Otherwise the PATHNAME slot value is restored to the original value after returning from this function.

If PARENTS is non-nil (default: t), ENSURE-DIRECTORIES-EXIST is called to
ensure that the path exists.

When an error occurs during the call to SAVE (e.g. nonexisting directory or permission error),
the path is reverted to the original value.

How it works:

1. SAVE generic-function stores a single line of macro (initialization-form) to
a temporary file and compiles a file under the dynamic environment where a
special variable *instance* is bound to the object to be stored.

2. The file compiler expands the macro to the code that sets *instance* to the
value of *instance*. MAKE-LOAD-FORM expands the value into a loadable form.

3. To load the instance, LOAD-INSTANCE function sets up a dynamic binding for
*instance* and load the compiled file in this dynamic environment. The
compiled code sets the newly created object (by evaluating the form produced
by make-load-form) to *instance*. LOAD-INSTANCE retrieves this value.

Package

serializable-object.

Source

package.lisp.

Methods
Method: save ((instance serializable-object) &key verbose parents compression overwrite &allow-other-keys)
Method: save :around ((instance serializable-object) &key pathname store &allow-other-keys)

5.1.3 Standalone methods

Method: make-load-form ((instance serializable-object) &optional env)
Source

package.lisp.


5.1.4 Classes

Class: serializable-object
Package

serializable-object.

Source

package.lisp.

Direct methods
Direct slots
Slot: pathname
Package

common-lisp.

Initargs

:pathname


5.2 Internals


5.2.1 Special variables

Special Variable: *instance*
Package

serializable-object.

Source

package.lisp.


5.2.2 Macros

Macro: initialization-form ()
Package

serializable-object.

Source

package.lisp.


Appendix A Indexes


A.1 Concepts


A.3 Variables