[closer-devel] Contextl patch: make ensure-layered-method work with function objects as well as names.
Pascal Costanza
pc at p-cos.net
Thu Oct 2 13:49:37 UTC 2008
Hi,
OK, I have added a slightly modified version to the repository. Thanks
a lot again for this patch.
Best,
Pascal
On 27 Sep 2008, at 23:05, Drew Crampsie wrote:
> Hello,
>
> In lol i use ensure-layered-method directly on generic functions. I've
> been using this modified version of ensure-layered-method and thought
> i'd try and sneak it in :).
>
> (defun ensure-layered-method
> (layered-function-designator
> lambda-expression
> &key
> (layered-function
> (if (functionp layered-function-designator)
> layered-function-designator
> (fdefinition (lf-definer-name layered-function-designator))))
> #-(or allegro clisp cmu ecl mcl openmcl)
> (method-class
> (generic-function-method-class
> layered-function))
> (in-layer 't)
> (qualifiers ())
> (lambda-list (cadr lambda-expression))
> (specializers (required-args lambda-list (constantly (find-
> class 't)))))
> (let ((layer-arg (gensym "LAYER-ARG-")))
> (destructuring-bind
> (lambda (&rest args) &body body)
> lambda-expression
> (unless (eq lambda 'lambda)
> (error "Incorrect lambda expression: ~S." lambda-expression))
> (ensure-method layered-function
> `(lambda (,layer-arg , at args) , at body)
> #-(or allegro clisp cmu ecl mcl openmcl) :method-
> class
> #-(or allegro clisp cmu ecl mcl openmcl) method-
> class
> :qualifiers qualifiers
> :lambda-list `(,layer-arg , at lambda-list)
> :specializers (cons (find-layer-class in-layer)
> specializers)))))
>
> Cheers,
>
> drewc
> _______________________________________________
> closer-devel mailing list
> closer-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/closer-devel
--
Pascal Costanza, mailto:pc at p-cos.net, http://p-cos.net
Vrije Universiteit Brussel, Programming Technology Lab
Pleinlaan 2, B-1050 Brussel, Belgium
More information about the closer-devel
mailing list