Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/17/84; site hplabsc.UUCP Path: utzoo!utcs!lsuc!pesnta!hplabsc!nielsen From: nielsen@hplabsc.UUCP (Walter Nielsen) Newsgroups: net.lang Subject: Re: (eq 4 (+ 2 2)) not always nil (I eat my words) Message-ID: <2800@hplabsc.UUCP> Date: Thu, 31-Oct-85 13:25:12 EST Article-I.D.: hplabsc.2800 Posted: Thu Oct 31 13:25:12 1985 Date-Received: Fri, 1-Nov-85 22:24:38 EST References: <2041@hcrvax.UUCP> <3509@utah-cs.UUCP> Organization: Hewlett Packard Labs, Palo Alto CA Lines: 24 > > Not in PSL, as can be ascertained by doing (in compiled code) > > (for (from i 0 1000000) (do (+ 2 2))) > > and observing that garbage collection doesn't *ever* seem to happen... > > > stan shebs If you look at the code generated by the PSL compiler, even at the C-macro level (by setting *plap to t), you will see that (+ 2 2) never gets evaluated. You should have gotten a message from the compiler to the effect of: "Value of (WCONST 4) not used, therefore not compiled" For that matter if you have a function defined as (DE FOO () (EQ 4 (+ 2 2))) and compile it, the resulting function is identical to (DE FOO () T). The reason for being is that the PSL compiler folds constants (i.e. evaluates constant expressions at compile-time) and in the first case does some data-flow analysis to see that the resulting value is never used again. Walter