The fare-mop Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The fare-mop Reference Manual

This is the fare-mop Reference Manual, version 1.0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Tue Nov 15 05:42:11 2022 GMT+0.

Table of Contents


1 Introduction

fare-mop has a few simple utilities relying on the MOP.
It depends on CLOSER-MOP for portable MOP access.

The main utilities are:

SIMPLE-PRINT-OBJECT-MIXIN
	class mixin to give you a useful PRINT-OBJECT method for free

SIMPLE-PRINT-OBJECT
	a simple PRINT-OBJECT function you can use it without the mixin
        (useful when you don't want to change the class hierarchy of
        some library you're using, but still want to simply inspect objects
        and/or define a PRINT-OBJECT method on them).

COLLECT-SLOTS
	a utility used by the above function, to collect a p-list
        describing the slots bound in an object

SLOTS-TO-PRINT
	a way to customize which slots get printed by SIMPLE-PRINT-OBJECT-MIXIN


Other utilities include:        

REMAKE-OBJECT
	a utility for "copying" objects by calling make-instance with
        the "same" initialization arguments as an original objects,
        plus overriding keyword arguments.
        Useful for experimenting with a pure functional OO style.
        Not for use where performance is important.

See documentation strings for details.


2 Systems

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


Previous: , Up: Systems   [Contents][Index]

2.1 fare-mop

Utilities using the MOP; notably make informative pretty-printing trivial

Author

Francois-Rene Rideau

Long Description

fare-mop is a small collection of utilities using the MOP.
It notably contains a method SIMPLE-PRINT-OBJECT, and
a mixin SIMPLE-PRINT-OBJECT-MIXIN that allow you to trivially define PRINT-OBJECT methods that print the interesting slots in your objects, which is great for REPL interaction and debugging.

Version

1.0.1

Dependencies
  • fare-utils (system)., at least version "1.0.0"
  • closer-mop (system).
Source

fare-mop.asd.

Child Components

3 Files

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


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.1 fare-mop/fare-mop.asd

Source

fare-mop.asd.

Parent Component

fare-mop (system).

ASDF Systems

fare-mop.


3.1.2 fare-mop/package.lisp

Source

fare-mop.asd.

Parent Component

fare-mop (system).

Packages

fare-mop.


Previous: , Up: Lisp   [Contents][Index]

3.1.3 fare-mop/utilities.lisp

Dependency

package.lisp (file).

Source

fare-mop.asd.

Parent Component

fare-mop (system).

Public Interface

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 fare-mop

Source

package.lisp.

Use List
  • closer-common-lisp.
  • fare-utils.
  • uiop/driver.
Public Interface

5 Definitions

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


Previous: , Up: Definitions   [Contents][Index]

5.1 Public Interface


5.1.1 Ordinary functions

Function: collect-slots (object &key slots)

Given an OBJECT and SLOTS designating a list of slot designators, return a p-list of an INITARG and VALUE
for each of those of the specified slots that are bound.
A slot designator may be a SLOT-DEFINITION object,
a KEYWORD specifying the INITARG of the slot,
or a SYMBOL naming the slot.
If the slot has no INITARG, the slot name is used instead in the p-list

Package

fare-mop.

Source

utilities.lisp.

Function: remake-object (object &rest keys &key &allow-other-keys)

A function to build a new object of the same class as OBJECT,
initialized with the specified KEYS, plus keys deduced from the original object by those slots that both are bound and have a defined initarg.
Note: this function is useful for experimental programming,
but use of runtime introspection means
this function isn’t suited where performance is important.

Package

fare-mop.

Source

utilities.lisp.

Function: simple-print-object (object stream &key identity slots)

This function will introspect you object’s slots to print it.
You can call it explicitly from your print-object methods,
or implicitly by just inheritting from SIMPLE-PRINT-OBJECT-MIXIN.
If SLOTS is T (the default), print all slots as per CLOSER-MOP:COMPUTE-SLOTS. If SLOTS is a list of slot designators, print them.
Slots are printed as a p-list as per FARE-MOP:COLLECT-SLOTS.
The IDENTITY keyword is as per PRINT-UNREADABLE-OBJECT.

Package

fare-mop.

Source

utilities.lisp.


5.1.2 Generic functions

Generic Function: slots-to-print (object)
Package

fare-mop.

Source

utilities.lisp.

Methods
Method: slots-to-print (object)

5.1.3 Standalone methods

Method: print-object ((object simple-print-object-mixin) stream)
Source

utilities.lisp.


5.1.4 Classes

Class: simple-print-object-mixin

Mixin to trivially give a print-object method to your class.
If you don’t want to print all slots, define a method on FARE-MOP:SLOTS-TO-PRINT to return a list of slot designators for those slots you want to print,
as per FARE-MOP:COLLECT-SLOTS.

Package

fare-mop.

Source

utilities.lisp.

Direct methods

print-object.


Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts


Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables