Re: warn if not top-level?



"Chris Riesbeck" <criesbeck@xxxxxxxxx> wrote in message
news:criesbeck-B9D9F5.14095027062005@xxxxxxxxxxxxxxxxx
>I have a macro RUN-TESTS that runs test code. (Tests
> are defined with DEFINE-TEST.) To support tests on macros,
> test code is stored uncompiled and assembled when RUN-TESTS
> is expanded.
>
> I would like to warn users that code like
>
> (DEFUN MY-TESTS () (RUN-TESTS ...))
>
> may be a mistake, since the code saved in MY-TESTS will
> no longer be updated when tests are updated or macros
> are redefined.
>
> Is there any portable way to recognize the above situation?
>
> Or should I change RUN-TESTS to expand into code that
> collects code at run-time and calls EVAL?

I know "don't do it" is an unsatisfying answer to "how do I do it?" but that
is probably mine in this case. The
"redefined-macro-mean-recompile-all-uses" rule must be well learned, usually
through pain therapy. You might do someone a very small favor with all your
contortions but it won't help them with all the cases where the function
called by run-tests contains old macro expansions (and may simply delay the
learning of the important lesson). Everybody either knows or must soon
learn that when you redefine a macro, you must recompile everything that
uses it.

--
Coby Beck
(remove #\Space "coby 101 @ bigpond . com")


.



Relevant Pages

  • Re: warn if not top-level?
    ... > I have a macro RUN-TESTS that runs test code. ... > test code is stored uncompiled and assembled when RUN-TESTS ... > Or should I change RUN-TESTS to expand into code that ... redefine the DEFUN macro. ...
    (comp.lang.lisp)
  • rpm and yum problems after fc2 to fc3 update
    ... I checked my rpm version ... error: Unterminated {: {lua: ... Macro %__policy_tree failed to expand ...
    (Fedora)
  • Re: Go ahead. Stop programming. This ensures you from any mistakes.
    ... It is not surprising -- in case of error, you leave resources unreleased. ... The only difference would be that the macro ... may expand to different code in release / debug versions. ... where allocation and deallocation occurs in one routine is not applicable. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: redefine Normal style in Word 2004
    ... Redefine Style has redefined the Normal ... I see absolutely no reason to have changed this. ... Take a look at the macro in appendix E ... Variants of this macro allow me to change the font of a style. ...
    (microsoft.public.mac.office.word)
  • Re: macro-biology
    ... > into a string that I pass to format. ... a macro can only expand into code, ... self-evaluating common lisp forms both are doable. ...
    (comp.lang.lisp)