Barry Margolin
6/2/2016 2:47:00 PM
In article <cf76072e-3286-4908-960e-84f51f95c8cd@googlegroups.com>,
Jim Newton <jimka.issy@gmail.com> wrote:
> I have code that makes several calculations each of which have several
> intermediate results.
> I'd like to use the CL condition system to signal the intermediate results.
> However, using SIGNAL in this ways, makes all the variable "used", so the
> code is not
> optimizable. I don't want these calls to signal to make the optimizer think
> that
> the results are "used".
>
> Is there a way to represent this?
>
> E.g.,
>
> (lambda (x)
> (let ((a (1+ x))
> (b (+ 3 x))
> (c (+ a b)))
> (signal 'condition-notify :variable 'a :value a)
> (signal 'condition-notify :variable 'b :value b)
> (signal 'condition-notify :variable 'c :value c)
> (+ 3 b)))
>
> In this code only the value b is "really used", I'd be happy if
> the optimizer eliminated the calculations of a and b, AND
Did you mean "a and c"?
> if it would also eliminate the calls 1st and 3rd calls to signal.
I don't understand, why should it eliminate them? Why are you calling it
if you don't want them to be executed?
Is this supposed to be a debugging feature that should only be enabled
in development mode? How about using a macro that generates the signal
calls only if a variable is set at compile time.
(defmacro debug-signal (&rest args)
(if *debug*
`(signal ,@args)
`(progn)))
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***