fare-mop

API Reference

fare-mop

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

FARE-MOP

  • Function COLLECT-SLOTS (object &key (slots t))
    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
  • Function SIMPLE-PRINT-OBJECT (object stream &key identity (slots t))
    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.
  • Generic-Function SLOTS-TO-PRINT (object)
  • Generic-Function SLOTS-TO-PRINT (object)
  • Class SIMPLE-PRINT-OBJECT-MIXIN  (STANDARD-OBJECT)
    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.
    No slots.
  • 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.