License: Public Domain , Load it with Quicklisp: (ql:quickload "class-options")
Library type: Convenience features , Project complexity: Trivial/Simple

class-options provides easy access to the defining class and its options
during initialization or reinitialization of its subcomponents.

Dictionary

Dictionary » class-options

Package class-options

Description

All symbols from this package should normally be explicitly qualified, such as class-options:class.
Don't (:use)!

Dictionary » Class access

Dictionary » Class access » class-mixin

Class class-options:class-mixin

standard-class

Description

Simply inherit from this class, then you can easily retrieve the class during initialization or reinitialization by calling class-options:class.

Method initialize-instance :around

(class class-options:class-mixin) &key => class

Description

Binds class as the value of an internal special variable, then calls the next method.

Call class-options:class to retrieve class.

Method reinitialize-instance :around

(class class-options:class-mixin) &key => class

Description

Behaves the same as the above method.

Dictionary » Class access » class

Function class-options:class

=> defining-class

Arguments and Values

  • defining-class -- A class.

Description

If a class that inherits from class-options:class-mixin is currently being defined or redefined, then return that class.

Else, (error 'class-options:read-error :reader 'class-options:class :required-mixin 'class-options:class-mixin).

Dictionary » Options access

Dictionary » Options access » options-mixin

Class class-options:options-mixin

standard-class

Description

Simply inherit from this class, then you can easily retrieve the canonicalized class options during initialization or reinitialization by calling class-options:options.

Method initialize-instance :around

(class class-options:options-mixin) &key => class

Description

Binds the result of calling (apply #'class-options:canonicalize-options class options) as the value of an internal special variable, then calls the next method with class and canonicalized-options.

During the call to class-options:canonicalize-options, class-options:operation can be called to determine if we are defining or redefining the class, regardless of if class inherits from class-options:operation-mixin or not.

Call class-options:options to retrieve canonicalized-options.

Dictionary » Options access » options

Function class-options:options

=> defining-class

Arguments and Values

  • defining-class -- A class.

Description

If a class that inherits from class-options:options-mixin is currently being defined or redefined, then return the canonicalized options for that class.

Else, (error 'class-options:read-error :reader 'class-options:options :required-mixin 'class-options:options-mixin).

Dictionary » Options access » canonicalize-options

Generic Function class-options:canonicalize-options

class &rest options &key &allow-other-keys => canonicalized-options

Arguments and Values

  • class -- A class.
  • options -- A plist.

Description

Canonicalizes options for class, which is its initargs.

Methods

Method class-options:canonicalize-options

(class class) &rest options => options

Description

Returns options.

Dictionary » Operation access

Dictionary » Operation access » operation-mixin

Class class-options:operation-mixin

standard-class

Description

Simply inherit from this class, then you can easily figure out if the class is being defined or redefined by calling class-options:operation.

Method initialize-instance :around

(class class-options:operation-mixin) &key => class

Description

Binds the symbol initialize-instance as the value of an internal special variable, then calls the next method.

Call class-options:operation to retrieve the symbol.

Method reinitialize-instance :around

(class class-options:operation-mixin) &key => class

Description

Behaves the same as the above method, except the symbol reinitialize-instance is used.

Dictionary » Operation access » operation

Function class-options:operation

=> operation

Arguments and Values

  • operation -- The symbol initialize-instance or reinitialize-instance.

Description

If a class that inherits from class-options:operation-mixin is currently being defined or redefined,
or class-options:canonicalize-options is being called during initialization or reinitialization of a class-options:options-mixin,
then return the symbol initialize-instance or reinitialize-instance, respectively.

Else, (error 'class-options:read-error :reader 'class-options:operation :required-mixin 'class-options:operation-mixin).

Dictionary » read-error

Condition class-options:read-error

error

Description

Slots:

((reader :initarg :reader
         :reader class-options:reader
         :type symbol
         :documentation "Names the reader function that was called.")
 (required-mixin :initarg :required-mixin
                 :reader class-options:required-mixin
                 :type symbol
                 :documentation "Names the mixin that the class should inherit from
                                 for the reader function that was called to return the requested information."))

The consequences are undefined if the :reader or :required-mixin initargs are unsupplied.

Generic Function class-options:reader

object => reader-name

Description

See above.

Generic Function class-options:required-mixin

object => mixin-name

Description

See above.