[comp.sys.xerox] problems with ADVICEs in lyric

Kevin_Crowston@XV.MIT.EDU (02/19/88)

SID#: 0208-113
Company Name: MIT/Mass Institute of Technology
Machine Type: 1109
Lisp version:  Lyric

I'm having a little problem with ADVICEs in lyric.  I want to store them
on a file, so I put (ADVICE fn-name) in the FILECOMS.  When I store
the file, however, I do (MAKEFILE file-name '(FAST RC ST)) which
I think reloads the file.  The advice then seems to double (that is, if I
edit the ADVICE, I see that the same ADVICE has been applied twice).
Worse, every time I MAKEFILE the file, I double it again, so after
four or five tries, I get 16 or 32 copies of the ADVICE.  Also, the file
is dirty again immediately after the MAKEFILE, since the ADVICEs
have been changed.

Anyone know a way around this?  I used to do something like

(ADVICE fn-name)
(P (READVISE fn-name))

in Koto, but that doesn't seem to do much better, since the implementation
of ADVISEs is different.  I'm sure there's some new idiom for dealing
with ADVISEs, since it seems unlikely that people simply edit them before
each MAKEFILE, but I haven't been able to guess what it is.

Kevin Crowston
MIT Sloan School of Management

AISupport.pasa@XEROX.COM (02/19/88)

Kevin,

We have received both your inquiries "problems with ADVICEs in lyric" and "can't
find package error message".  At this time, our database is down and we are
unable to process your questions.  We will message you with the assigned
supportlog numbers as soon as we are able.

Thank you,

Susan Trautz
AISupport

Richard Fritzson <fritzson@burdvax.prc.unisys.com> (02/20/88)

In article <0.43520.20995.54682.9677@XV.MIT.EDU> you write:
>I'm having a little problem with ADVICEs in lyric.  I want to store them
>on a file, so I put (ADVICE fn-name) in the FILECOMS.  When I store
>the file, however, I do (MAKEFILE file-name '(FAST RC ST)) which
>I think reloads the file.  The advice then seems to double (that is, if I
>edit the ADVICE, I see that the same ADVICE has been applied twice).
>Worse, every time I MAKEFILE the file, I double it again, so after
>four or five tries, I get 16 or 32 copies of the ADVICE.  Also, the file

The instructions generated by the ADVICE in the FILECOMS no longer
overwrite the existing advice, they augments it.  Every time you load
the file, the advice will double.

We reported this exasperating behavior last fall. It was written up in
the AIS hotline Bulletin #10 (January 15, 1988). Aside from clearly
explaining the problem, the bulletin article has this to say:

WORKAROUND: NONE
REFERENCE: AR8495, AR9440

The only thing I've been able to do is always edit all the advice in
the file every time I do a repeated load in order to eliminate the
duplication.  (Guess how often I save advice to files these days?)
-- 
	-Rich Fritzson
	 ARPA: fritzson@prc.unisys.com
	 UUCP: {sdcrdcf,psuvax1,cbmvax}!burdvax!fritzson

Jellinek.pa@XEROX.COM (02/20/88)

It almost goes without saying, though I'll say it anyway: in the case where only
one module will be advising a given function, you can put an (UNADVISE function)
in the filecoms before the function's advice.

		Herb

Lanning.pa@XEROX.COM (Stanley's Tool Works) (02/20/88)

With a small amount of effort, you can write a function PURGE-FILE-ADVICE that
removes redundent advice from a file.  Then add the form (PURGE-FILE-ADVICE
FILE) to the list MAKEFILEFORMS.

PURGE-FILE-ADVICE might look like

(LAMBDA (FILE)
  (for FN in (FILECOMSLST FILE 'ADVICE) do
     (PUTDEF FN 'ADVICE
        (CL:REMOVE-DUPLICATES (GETDEF FN 'ADVICE)
                              :TEST #'EQUAL))))

I haven't tested this out, but something like it will work.

----- smL

fons@cs.vu.nl (Fons Botman) (02/23/88)

L.S.

In article <0.43520.20995.54682.9677@XV.MIT.EDU> Kevin Crowston writes:
>I'm having a little problem with ADVICEs in lyric.  I want to store them
>...
>Worse, every time I MAKEFILE the file, I double it again, so after
>four or five tries, I get 16 or 32 copies of the ADVICE.  Also, the file
>is dirty again immediately after the MAKEFILE, since the ADVICEs
>have been changed.
>
>Anyone know a way around this?  I used to do something like
>
>(ADVICE fn-name)
>(P (READVISE fn-name))
>...

I use:
(P (UNADVISE 'fn-name))
(ADVISE fn-name)
which seems to work.  It can generate the warning "function not advised" the
first time, just ignore that.

But it would be preferrable that ADVISE would just throw away duplicate (i.e.
EQUAL) advice.

						The Fons