[comp.lang.lisp] LET vs. LET*

jeff@aiai.ed.ac.uk (Jeff Dalton) (04/07/90)

In article <35361@think.Think.COM> barmar@nugodot.think.com.UUCP (Barry Margolin) writes:
 >The parallel binding was a natural result of this expansion.  In these
 >systems LET was also often more efficient than LET* because LET* would
 >usually expand into nested LETs, which would then expand into nested
 >procedure calls, so the expense of LET* would be linear in the number of
 >variables, while LET would have constant overhead.  Note that this expense
 >wasn't actually necessary -- a good compiler could merge these nested
 >procedure calls (I think this is called beta-reduction), but I don't know
 >how many of the compilers developed in the 70's did this.

But compilers may well have treated calls where the function position
was a lambda-expression specially: that is, they could have treated it
as a declaration of local variables rather than as a function call.
And then the nested locals of a LET* might be compined into one stack
allocation by a variety of optimization techniques.  I would think
beta-reduction might be what happens in compilers that take a lambda
calculus approach (such as Steele's Rabbit compiler for Scheme and
perhaps the Lucid Common Lisp compiler), but more ordinary compilers
might still eliminate the overhead in one way or another.