sbcl / specializable

generalized specializers work
13 stars 2 forks source link

How to handle arguments and generalizers? #2

Closed scymtym closed 10 years ago

scymtym commented 10 years ago

We have two tasks at generic function invocation time:

  1. Turn the list of required arguments into a list of generalizers
  2. Compute a list of "effective arguments" for the effective method (e.g. pattern specializers inject variable bindings at this point)

    The first task is handled via either

    • generalizer-of-using-class gf arg

    Has the advantage of simplicity

    • or a combination of generalizers-of-using-class gf args and generalizer-of-using-class gf arg

    Has the disadvantage of complexity but is more powerful and can be more efficient. For example, the pattern-specializer implementation has a method which basically does (mapcar #'funcall list-of-generalizer-computation-functions args) without generic function calls for individual arguments.

Potential improvements:

One solution could be a new protocol function compute-effective-arguments-function gf num-required which would return a function with lambda-list (args generalizers) which would in turn produce the "effective argument list" when called, for example by injecting additional arguments.