[log5-devel] Negation does not work in sender spec

Gary King gwking at metabang.com
Sun Dec 23 02:51:45 UTC 2007


Hi Ilya,

Thanks again for pointing out this problem; I've corrected the bug and  
rolled out 0.3.1.

One perhaps surprising / perhaps wrong thing is outlined in this test:

> (addtest (test-negated-categories)
>   start-sender
>   (let ((string
> 	 (with-output-to-string (stream)
> 	   (start-sender-fn 'test-negated-categories
> 			    '(and nc-foo (not nc-bar)) '(message)
> 			    'stream-sender :location stream)
> 	   (log-for (nc-foo) "absence is negation?")
> 	   (log-for (nc-bar) "no")
> 	   (log-for (nc-foo (not nc-bar)) "yes")
> 	   (log-for (and (not nc-foo) (not nc-bar)) "no")
> 	   )))
>     (ensure-same string
> 		 (format nil "\"absence is negation?\"~&\"yes\"")
> 		 :test 'string=)))

The output of the bottom three `log-for` commands is, I think,  
unobjectionable.
The question is what it should do in the `(log-for (nc-foo)` case.  
Currently, log5 treats the absence of category _as_ negation and so  
the command outputs the message. It might be better to have a sort-of  
three-valued logic that incorporated missings but it's not immediately  
clear that this actually useful or conceptually simple!

If you have any opinions, please me know.


On Dec 20, 2007, at 2:20 PM, Ilya Perminov wrote:

> Hi,
>
> The following code gives "Variable BAR undefined" error:
> (defcategory foo)
> (defcategory bar)
> (start-sender 'console-log1
>                 (stream-sender :location *error-output*)
>                 :category-spec (and foo (not bar))
>                 :output-spec (category message))
>
> I think the problem is in sender-responds-to-category-p.
> determine-category-variables returns two list, but
> sender-responds-to-category-p does not use the second one
> (negated variables).
>
> Regards,
> Ilya
> _______________________________________________
> log5-devel mailing list
> log5-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/log5-devel

--
Gary Warren King, metabang.com
Cell: (413) 559 8738
Fax: (206) 338-4052
gwkkwg on Skype * garethsan on AIM







More information about the Log5-devel mailing list