Christophe Weblog Wiki Code Publications Music
initial import of pattern-specializer system
[specializable.git] / src / pattern-specializer / protocol.lisp
1 ;;;; protocol.lisp --- Protocol used by pattern specializers.
2 ;;;;
3 ;;;; Copyright (C) 2014 Jan Moringen
4 ;;;;
5 ;;;; Author: Jan Moringen <jmoringe@techfak.uni-bielefeld.de>
6
7 (cl:in-package #:pattern-specializer)
8
9 ;;; Pattern specializer protocol
10
11 (defgeneric specializer-accepts-generalizer-p-using-pattern
12     (generic-function specializer pattern generalizer)
13   (:documentation
14    "Like SPECIALIZER-ACCEPTS-GENERALIZER-P but with the ability to
15     dispatch on PATTERN."))
16
17 ;;; Pattern generic function protocol
18
19 (defgeneric generic-function-specializer-clusters (generic-function)
20   (:documentation
21    "Return a list of specializer cluster for
22     GENERIC-FUNCTION. Assuming GENERIC-FUNCTION has N required
23     parameters, the returned list is of the following form
24
25       ((PARAM_1-CLUSTER_1 ... PARAM_1-CLUSTER_M_1)
26        ...
27        (PARAM_N-CLUSTER_1 ... PARAM_N-CLUSTER_M_N)
28
29     where each PARAM_I_CLUSTER_J is a sorted list of `pattern-specializer's
30
31       (SPECIALIZER_1 ... SPECIALIZER_L)
32
33     such that for an object O
34
35       SPECIALIZER_I accepts O => SPECIALIZER_K accepts O
36
37     for K >= I."))
38
39 (defgeneric generic-function-generalizer-makers (generic-function)
40   (:documentation
41    "TODO"))
42
43 (defgeneric in-same-cluster-p (generic-function specializer1 specializer2)
44   (:documentation
45    "Return true if for GENERIC-FUNCTION SPECIALIZER1 and SPECIALIZER2
46     are in the same cluster."))