The incongruent-methods Reference Manual

Table of Contents

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

The incongruent-methods Reference Manual

This is the incongruent-methods Reference Manual, version 0.1, generated automatically by Declt version 2.3 "Robert April" on Wed Mar 14 04:04:37 2018 GMT+0.


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

1 Introduction

* Incongruent methods

** Basics

Incongruent methods is a simple implementation of
incongruent (overloaded) methods using standard CLOS methods.  These
methods do not support &key, &rest, &optional etc.

Example:

  (define-incongruent-method hello ((me string))
    (concatenate 'string "Hello, " me))

  (define-incongruent-method hello ((me string) (greeting string))
    (concatenate 'string greeting ", " me))

  (hello "world")
  ==> "Hello world"

  (hello "world" "Hey")
  ==> "Hey world"


Example 2:

  (defclass hello ()
    ((message :initarg :message
              :initform nil
              :accessor %get-message))) ;; standard generic accessor.

  (define-incongruent-method greet ((me hello))
    (print (%get-message me)))

  (define-incongruent-method greet ((me hello) (n integer))
    (dotimes (m n)
      (greet me)))


** Shared methods

Methods that are "shared" between packages can be also be defined.
These methods can be called using the "imcall" function.  It is
advisable that shared methods are specialized on at least one class
defined in your own system.  A shared method specializing only on,
say, the built-in integer class, might accidentally get redefined by
other systems.

- Operations that are part of the "public interface" of a class are
  good candidates for shared methods.

- In the following example, notice how the call to "notify" in the
  do-something method refers to test-package-1::notify, not
  test-package-2::notify.  In fact, test-package-1 has no knowledge of
  the other package and can be compiled separately if one wishes.


Example:

  (defpackage :test-package-1
    (:use :cl :incongruent-methods)
    (:export #:my-class))

  (in-package :test-package-1)

  (defclass my-class ()
    ((slot :accessor %get-slot)))

  (define-shared-method slot-contents ((me my-class))
    (slot-value me 'slot))

  (define-shared-method get-something ((me my-class))
    'something)

  (define-shared-method do-something ((me my-class)
                                      (object t))
    (format t "I did something!~%")
    (imcall 'notify object :done))

  ;;;;

  (defpackage :test-package-2
    (:use :cl :incongruent-methods))

  (in-package :test-package-2)

  (defclass some-random-class () ())

  (define-shared-method notify ((me some-random-class)
                                (status symbol))
    (format t "Received status: ~A~%" status))

  (defun main ()
    (let ((my-object (make-instance 'test-package-1:my-class))
          (some-object (make-instance 'some-random-class)))
      (format t "~S~%" (imcall 'get-something my-object))
      (imcall 'do-something my-object some-object)))


  CL-USER> (main)

  ==>

  TEST-PACKAGE-1::SOMETHING
  I did something!
  Received status: DONE


** Define-class

A convenience macro for defining classes is also provided.  The
symbol "ME" in the body of the methods means the current object (self,
this etc).  It should also be the first argument when calling methods
defined using this macro.  Accessors will be converted to incongruent
methods.

Example:

(define-class greeting ()
    ((message :accessor message :initform nil)
     (some-slot :accessor some-slot :initform nil))

  ;; Methods can be defined here, if one wants.

  (greet () ;; lambda list is actually ((me greeting))
    (message me))

  (greet ((n integer)) ;; lambda list is actually ((me greeting) (n integer))
    (dotimes (m n)
      (greet me)))

  (greet ((n (eql 42)))
    (some-slot me))

  ((setf greet) (new)
    (setf (message me) new)))


(let ((i (make-instance 'greeting :message "Hello")))
  (greet i))

==> "Hello"

(let ((i (make-instance 'greeting :message "Hello")))
  (setf (greet i) "Hi")
  (greet i))

==> "Hi"



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

2 Systems

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


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

2.1 incongruent-methods

Author

Peter von Etter

License

LLGPL

Description

Methods with incongruent lambda lists.

Version

0.1

Dependency

closer-mop

Source

incongruent-methods.asd (file)

Components

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

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 files   [Contents][Index]

3.1.1 incongruent-methods.asd

Location

incongruent-methods.asd

Systems

incongruent-methods (system)


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

3.1.2 incongruent-methods/package.lisp

Parent

incongruent-methods (system)

Location

package.lisp

Packages

incongruent-methods


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

3.1.3 incongruent-methods/incongruent-methods.lisp

Dependency

package.lisp (file)

Parent

incongruent-methods (system)

Location

incongruent-methods.lisp

Exported Definitions
Internal Definitions

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

3.1.4 incongruent-methods/shared-methods.lisp

Dependency

incongruent-methods.lisp (file)

Parent

incongruent-methods (system)

Location

shared-methods.lisp

Packages

incongruent-methods.methods

Exported Definitions
Internal Definitions

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

3.1.5 incongruent-methods/class-methods.lisp

Dependency

shared-methods.lisp (file)

Parent

incongruent-methods (system)

Location

class-methods.lisp

Exported Definitions
Internal Definitions

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

4 Packages

Packages are listed by definition order.


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

4.1 incongruent-methods

Source

package.lisp (file)

Use List

common-lisp

Exported Definitions
Internal Definitions

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

4.2 incongruent-methods.methods

Source

shared-methods.lisp (file)


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

5 Definitions

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


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

5.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Macros

Macro: define-class NAME DIRECT-SUPERCLASSES DIRECT-SLOTS &body METHODS
Package

incongruent-methods

Source

class-methods.lisp (file)

Macro: define-class-method NAME METHOD-LAMBDA-LIST &body BODY
Package

incongruent-methods

Source

class-methods.lisp (file)

Macro: define-incongruent-method NAME METHOD-LAMBDA-LIST &body BODY
Package

incongruent-methods

Source

incongruent-methods.lisp (file)

Macro: define-shared-method NAME METHOD-LAMBDA-LIST &body BODY
Package

incongruent-methods

Source

shared-methods.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.2 Compiler macros

Compiler Macro: imcall METHOD &rest ARGS
Package

incongruent-methods

Source

shared-methods.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.3 Functions

Function: (setf imcall) NEW METHOD &rest ARGS
Package

incongruent-methods

Source

shared-methods.lisp (file)

Reader

imcall (generic function)

Function: list-incongruent-methods NAME
Package

incongruent-methods

Source

incongruent-methods.lisp (file)

Function: list-shared-methods NAME
Package

incongruent-methods

Source

shared-methods.lisp (file)

Function: remove-incongruent-function NAME
Package

incongruent-methods

Source

incongruent-methods.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

5.1.4 Generic functions

Generic Function: imcall METHOD &rest ARGS
Package

incongruent-methods

Source

shared-methods.lisp (file)

Writer

(setf imcall) (function)

Methods
Method: imcall (METHOD symbol) &rest ARGS

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

5.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Special variables

Special Variable: *class-principal-methods*
Package

incongruent-methods

Source

class-methods.lisp (file)

Special Variable: *generic-arity-functions*
Package

incongruent-methods

Source

incongruent-methods.lisp (file)

Special Variable: *indentation-hints*
Package

incongruent-methods

Source

class-methods.lisp (file)

Special Variable: *method-package*
Package

incongruent-methods

Source

shared-methods.lisp (file)

Special Variable: *methods-with-arity*
Package

incongruent-methods

Source

incongruent-methods.lisp (file)

Special Variable: *setf-methods-with-arity*
Package

incongruent-methods

Source

incongruent-methods.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.2 Macros

Macro: clear-class-methods NAME
Package

incongruent-methods

Source

class-methods.lisp (file)

Macro: internf-shared-method PLACE
Package

incongruent-methods

Source

shared-methods.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.3 Functions

Function: %add-method-with-arity NAME ARITY TABLE &optional SETF
Package

incongruent-methods

Source

incongruent-methods.lisp (file)

Function: %find-method GF QUALIFIERS SPECIALIZERS &optional ERRORP
Package

incongruent-methods

Source

class-methods.lisp (file)

Function: %find-method-with-arity NAME ARITY TABLE
Package

incongruent-methods

Source

incongruent-methods.lisp (file)

Function: %remove-method-with-arity NAME ARITY TABLE
Package

incongruent-methods

Source

incongruent-methods.lisp (file)

Function: add-class-principal-method NAME METHOD-LAMBDA-LIST
Package

incongruent-methods

Source

class-methods.lisp (file)

Function: bad-lambda-list-p LAMBDA-LIST
Package

incongruent-methods

Source

incongruent-methods.lisp (file)

Function: clear-shared-methods ()
Package

incongruent-methods

Source

shared-methods.lisp (file)

Function: dispatcher-compiler-macro FORM
Package

incongruent-methods

Source

incongruent-methods.lisp (file)

Function: ensure-dispatcher NAME
Package

incongruent-methods

Source

incongruent-methods.lisp (file)

Function: ensure-generic-arity-function NAME ARITY
Package

incongruent-methods

Source

incongruent-methods.lisp (file)

Function: error-on-bad-lambda-list NAME LAMBDA-LIST
Package

incongruent-methods

Source

incongruent-methods.lisp (file)

Function: find-bound-symbol SYMBOL PACKAGE
Package

incongruent-methods

Source

class-methods.lisp (file)

Function: list-class-principal-methods CLASS-NAME
Package

incongruent-methods

Source

class-methods.lisp (file)

Function: list-incongruent-generic-functions NAME
Package

incongruent-methods

Source

incongruent-methods.lisp (file)

Function: method-lambda-list-arity LAMBDA-LIST
Package

incongruent-methods

Source

incongruent-methods.lisp (file)

Function: method-parameter-name X
Package

incongruent-methods

Source

incongruent-methods.lisp (file)

Function: method-parameter-type X
Package

incongruent-methods

Source

incongruent-methods.lisp (file)

Function: remove-class-principal-methods CLASS-NAME
Package

incongruent-methods

Source

class-methods.lisp (file)

Function: setf-method-p NAME
Package

incongruent-methods

Source

incongruent-methods.lisp (file)

Function: update-indentation-hints ()
Package

incongruent-methods

Source

class-methods.lisp (file)

Function: without-props PLIST PROPS
Package

incongruent-methods

Source

class-methods.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

5.2.4 Generic functions

Generic Function: add-method-with-arity NAME ARITY
Package

incongruent-methods

Source

incongruent-methods.lisp (file)

Methods
Method: add-method-with-arity (NAME list) ARITY
Method: add-method-with-arity (NAME symbol) ARITY
Generic Function: find-method-with-arity NAME ARITY
Package

incongruent-methods

Source

incongruent-methods.lisp (file)

Methods
Method: find-method-with-arity (NAME list) ARITY
Method: find-method-with-arity (NAME symbol) ARITY
Generic Function: find-setf-method-with-arity NAME ARITY
Package

incongruent-methods

Source

incongruent-methods.lisp (file)

Methods
Method: find-setf-method-with-arity (NAME symbol) ARITY
Generic Function: find-shared-method NAME
Package

incongruent-methods

Source

shared-methods.lisp (file)

Methods
Method: find-shared-method (NAME list)
Method: find-shared-method (NAME string)
Method: find-shared-method (NAME symbol)
Generic Function: incongruent-function-p NAME
Package

incongruent-methods

Source

incongruent-methods.lisp (file)

Methods
Method: incongruent-function-p NAME
Generic Function: intern-shared-method THING
Package

incongruent-methods

Source

shared-methods.lisp (file)

Methods
Method: intern-shared-method (NAME list)
Method: intern-shared-method (NAME symbol)
Generic Function: method-name-with-arity NAME ARITY
Package

incongruent-methods

Source

incongruent-methods.lisp (file)

Methods
Method: method-name-with-arity (NAME list) ARITY
Method: method-name-with-arity (NAME symbol) ARITY
Generic Function: remove-method-with-arity NAME ARITY
Package

incongruent-methods

Source

incongruent-methods.lisp (file)

Methods
Method: remove-method-with-arity (NAME list) ARITY
Method: remove-method-with-arity (NAME symbol) ARITY
Generic Function: send OBJECT METHOD &rest ARGS
Package

incongruent-methods

Source

shared-methods.lisp (file)


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

Appendix A Indexes


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

A.1 Concepts

Jump to:   F   I   L  
Index Entry  Section

F
File, Lisp, incongruent-methods.asd: The incongruent-methods<dot>asd file
File, Lisp, incongruent-methods/class-methods.lisp: The incongruent-methods/class-methods<dot>lisp file
File, Lisp, incongruent-methods/incongruent-methods.lisp: The incongruent-methods/incongruent-methods<dot>lisp file
File, Lisp, incongruent-methods/package.lisp: The incongruent-methods/package<dot>lisp file
File, Lisp, incongruent-methods/shared-methods.lisp: The incongruent-methods/shared-methods<dot>lisp file

I
incongruent-methods.asd: The incongruent-methods<dot>asd file
incongruent-methods/class-methods.lisp: The incongruent-methods/class-methods<dot>lisp file
incongruent-methods/incongruent-methods.lisp: The incongruent-methods/incongruent-methods<dot>lisp file
incongruent-methods/package.lisp: The incongruent-methods/package<dot>lisp file
incongruent-methods/shared-methods.lisp: The incongruent-methods/shared-methods<dot>lisp file

L
Lisp File, incongruent-methods.asd: The incongruent-methods<dot>asd file
Lisp File, incongruent-methods/class-methods.lisp: The incongruent-methods/class-methods<dot>lisp file
Lisp File, incongruent-methods/incongruent-methods.lisp: The incongruent-methods/incongruent-methods<dot>lisp file
Lisp File, incongruent-methods/package.lisp: The incongruent-methods/package<dot>lisp file
Lisp File, incongruent-methods/shared-methods.lisp: The incongruent-methods/shared-methods<dot>lisp file

Jump to:   F   I   L  

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

A.2 Functions

Jump to:   %   (  
A   B   C   D   E   F   G   I   L   M   R   S   U   W  
Index Entry  Section

%
%add-method-with-arity: Internal functions
%find-method: Internal functions
%find-method-with-arity: Internal functions
%remove-method-with-arity: Internal functions

(
(setf imcall): Exported functions

A
add-class-principal-method: Internal functions
add-method-with-arity: Internal generic functions
add-method-with-arity: Internal generic functions
add-method-with-arity: Internal generic functions

B
bad-lambda-list-p: Internal functions

C
clear-class-methods: Internal macros
clear-shared-methods: Internal functions
Compiler Macro, imcall: Exported compiler macros

D
define-class: Exported macros
define-class-method: Exported macros
define-incongruent-method: Exported macros
define-shared-method: Exported macros
dispatcher-compiler-macro: Internal functions

E
ensure-dispatcher: Internal functions
ensure-generic-arity-function: Internal functions
error-on-bad-lambda-list: Internal functions

F
find-bound-symbol: Internal functions
find-method-with-arity: Internal generic functions
find-method-with-arity: Internal generic functions
find-method-with-arity: Internal generic functions
find-setf-method-with-arity: Internal generic functions
find-setf-method-with-arity: Internal generic functions
find-shared-method: Internal generic functions
find-shared-method: Internal generic functions
find-shared-method: Internal generic functions
find-shared-method: Internal generic functions
Function, %add-method-with-arity: Internal functions
Function, %find-method: Internal functions
Function, %find-method-with-arity: Internal functions
Function, %remove-method-with-arity: Internal functions
Function, (setf imcall): Exported functions
Function, add-class-principal-method: Internal functions
Function, bad-lambda-list-p: Internal functions
Function, clear-shared-methods: Internal functions
Function, dispatcher-compiler-macro: Internal functions
Function, ensure-dispatcher: Internal functions
Function, ensure-generic-arity-function: Internal functions
Function, error-on-bad-lambda-list: Internal functions
Function, find-bound-symbol: Internal functions
Function, list-class-principal-methods: Internal functions
Function, list-incongruent-generic-functions: Internal functions
Function, list-incongruent-methods: Exported functions
Function, list-shared-methods: Exported functions
Function, method-lambda-list-arity: Internal functions
Function, method-parameter-name: Internal functions
Function, method-parameter-type: Internal functions
Function, remove-class-principal-methods: Internal functions
Function, remove-incongruent-function: Exported functions
Function, setf-method-p: Internal functions
Function, update-indentation-hints: Internal functions
Function, without-props: Internal functions

G
Generic Function, add-method-with-arity: Internal generic functions
Generic Function, find-method-with-arity: Internal generic functions
Generic Function, find-setf-method-with-arity: Internal generic functions
Generic Function, find-shared-method: Internal generic functions
Generic Function, imcall: Exported generic functions
Generic Function, incongruent-function-p: Internal generic functions
Generic Function, intern-shared-method: Internal generic functions
Generic Function, method-name-with-arity: Internal generic functions
Generic Function, remove-method-with-arity: Internal generic functions
Generic Function, send: Internal generic functions

I
imcall: Exported compiler macros
imcall: Exported generic functions
imcall: Exported generic functions
incongruent-function-p: Internal generic functions
incongruent-function-p: Internal generic functions
intern-shared-method: Internal generic functions
intern-shared-method: Internal generic functions
intern-shared-method: Internal generic functions
internf-shared-method: Internal macros

L
list-class-principal-methods: Internal functions
list-incongruent-generic-functions: Internal functions
list-incongruent-methods: Exported functions
list-shared-methods: Exported functions

M
Macro, clear-class-methods: Internal macros
Macro, define-class: Exported macros
Macro, define-class-method: Exported macros
Macro, define-incongruent-method: Exported macros
Macro, define-shared-method: Exported macros
Macro, internf-shared-method: Internal macros
Method, add-method-with-arity: Internal generic functions
Method, add-method-with-arity: Internal generic functions
Method, find-method-with-arity: Internal generic functions
Method, find-method-with-arity: Internal generic functions
Method, find-setf-method-with-arity: Internal generic functions
Method, find-shared-method: Internal generic functions
Method, find-shared-method: Internal generic functions
Method, find-shared-method: Internal generic functions
Method, imcall: Exported generic functions
Method, incongruent-function-p: Internal generic functions
Method, intern-shared-method: Internal generic functions
Method, intern-shared-method: Internal generic functions
Method, method-name-with-arity: Internal generic functions
Method, method-name-with-arity: Internal generic functions
Method, remove-method-with-arity: Internal generic functions
Method, remove-method-with-arity: Internal generic functions
method-lambda-list-arity: Internal functions
method-name-with-arity: Internal generic functions
method-name-with-arity: Internal generic functions
method-name-with-arity: Internal generic functions
method-parameter-name: Internal functions
method-parameter-type: Internal functions

R
remove-class-principal-methods: Internal functions
remove-incongruent-function: Exported functions
remove-method-with-arity: Internal generic functions
remove-method-with-arity: Internal generic functions
remove-method-with-arity: Internal generic functions

S
send: Internal generic functions
setf-method-p: Internal functions

U
update-indentation-hints: Internal functions

W
without-props: Internal functions

Jump to:   %   (  
A   B   C   D   E   F   G   I   L   M   R   S   U   W  

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

A.3 Variables

Jump to:   *  
S  
Index Entry  Section

*
*class-principal-methods*: Internal special variables
*generic-arity-functions*: Internal special variables
*indentation-hints*: Internal special variables
*method-package*: Internal special variables
*methods-with-arity*: Internal special variables
*setf-methods-with-arity*: Internal special variables

S
Special Variable, *class-principal-methods*: Internal special variables
Special Variable, *generic-arity-functions*: Internal special variables
Special Variable, *indentation-hints*: Internal special variables
Special Variable, *method-package*: Internal special variables
Special Variable, *methods-with-arity*: Internal special variables
Special Variable, *setf-methods-with-arity*: Internal special variables

Jump to:   *  
S  

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

A.4 Data types

Jump to:   I   P   S  
Index Entry  Section

I
incongruent-methods: The incongruent-methods system
incongruent-methods: The incongruent-methods package
incongruent-methods.methods: The incongruent-methods<dot>methods package

P
Package, incongruent-methods: The incongruent-methods package
Package, incongruent-methods.methods: The incongruent-methods<dot>methods package

S
System, incongruent-methods: The incongruent-methods system

Jump to:   I   P   S