JESS: Strange behaviour of defadvice

Gaëtan Pruvost <[email protected]>
Newsgroups gmane.comp.java.jess
Message-ID <[email protected]>
  Hi everybody,

I have a problem with defadvice's behavior. It looks like you can't add 
both a "before" and an "after" advice to the same function.
Here is an example that demonstrates it

(deffunction f ()
     (printout t "during f" crlf))

(defadvice before f (printout t "before f" crlf))
(defadvice after f (printout t "after f" crlf))

(f)


It prints:
Jess> (batch "test.clp")
during f
after f
Jess>

Looks like the after overwrote the before one and there is no way to 
define both at the same time...
I'm new to Jess so I hope this question is not stupid but i looked in 
documentation and in the old mailling-list messages and found no 
explaination for it. Is it the intended behaviour (in which case it 
would be good to precise it in the doc) or a bug? I'm using the last 
Jess71p2.

I needed this to unbind global variables before a bsave and rebind after 
the bsave (this variable refers to a java Logger which is not 
serializable). I've found another solution wihtout using defadvice but I 
find the defadvice more elegant.


Best regards

-- 
***********************************
Gaëtan PRUVOST

LIMSI-CNRS BP 133
91403 Orsay Cedex France
Tel:+33 1 69858110

http://www.limsi.fr/Individu/pruvost/
***********************************
gaetan_pruvost.vcf (text/plain, 188 B)
begin:vcard
fn;quoted-printable:Ga=C3=ABtan Pruvost
n;quoted-printable:Pruvost;Ga=C3=ABtan
email;internet:[email protected]
tel;work:+33 1
x-mozilla-html:TRUE
version:2.1
end:vcard
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.