[closer-devel] remove a layered method

Pascal Costanza pc at p-cos.net
Fri Feb 16 09:23:04 UTC 2007


On 16 Feb 2007, at 03:22, Igor Plekhov wrote:

> How can I remove a layered method (previously defined with
> define-layered-method)?

I am terribly sorry, but there is currently no easy way to achieve  
this. I will fix this as part of completing the ContextL API soon.

Until then, here is a workaround that you can use:

Assume, you have defined a layered function foo like this:

(define-layered-function foo (x y z))

Such a definition actually creates two functions: The function foo  
that you can call, and an internal generic function that takes the  
method definitions. I separate layered functions into to functions  
internally so that I can easily add the implicit parameter that  
represents the current layer combination.

The name of the internally created generic function can be accessed  
via contextl::get-layered-function-definer-name, so if you want to  
access the generic function, you can call:

(fdefinition (contextl::get-layered-function-definer-name 'foo))

You can then call generic-function-methods on that generic function.  
You can also call find-method, remove-method and add-method. However,  
note that the methods take the additional layer parameter, so you  
have to watch out to use the correct specializers.

As I said, I hope I can provide a better interface soon.

Let me know if the above works for you.


Cheers,
Pascal

-- 
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