16 Feb 2007 03:22
16 Feb 2007 05:37
16 Feb 2007 10:23
Re: remove a layered method
Pascal Costanza <pc <at> p-cos.net>
2007-02-16 09:23:04 GMT
2007-02-16 09:23:04 GMT
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(Continue reading)
16 Feb 2007 10:38
Re: with-active-layers
Pascal Costanza <pc <at> p-cos.net>
2007-02-16 09:38:49 GMT
2007-02-16 09:38:49 GMT
On 16 Feb 2007, at 05:37, Igor Plekhov wrote: > What is the difference between with-active-layers and > with-active-layers* in ContextL? You can use with-active-layers in two ways: (1) Just with layer names: (with-active-layers (l1 l2 l3) ... some code ...) (2) With additional initargs: (with-active-layers ((l1 :foo 42)) ... some code ...) The second use assumes that the layer l1 has been defined with a special slot with :foo as an initarg, for example like this: (deflayer l1 () ((foo :initarg :foo :special t :reader foo))) The layer activation (2) additionally rebinds the layer-specific slot 'foo with dynamic scope. The two variations with-active-layers and with-active-layers* only make a difference when such dynamically scoped rebindings of layer- specific special slots are involved. The difference is as follows.(Continue reading)
17 Feb 2007 13:25
Re: remove a layered method
Igor Plekhov <penguin <at> ocean.vvo.ru>
2007-02-17 12:25:30 GMT
2007-02-17 12:25:30 GMT
On Fri, 16 Feb, 2007 at 10:23:04 +0100, Pascal Costanza wrote: > > >How can I remove a layered method (previously defined with > >define-layered-method)? > > (define-layered-function foo (x y z)) > (fdefinition (contextl::get-layered-function-definer-name 'foo)) > Let me know if the above works for you. Yes, it does. #'contextl::get-layered-function-definer-name gives me some symbol, using which I can easily get a list of function's methods in Slime's inspector. -- Registered Linux User #124759
RSS Feed