As probably all experienced elispers have found at some point, code like is broken:
(let ((a 3)
(b 4)
(c (+ a b)))
c)
One should use the let* form instead when referring to a just-binded variable within the binding clauses.
I just wonder – why is a seemingly wrong behavior the default? Are there any risks on choosing always let* regardless of how is one gonna use it?
I was taught that the reason is mainly historical, but it might still hold: Since
letdoes parallel assigment, having no data dependencies between the variables might give the compiler flexibility compile for speed or space and compile to something much faster thanlet*. I don’t know how much the elisp compiler uses this.A bit of googling reveals a similar question for Common Lisp: LET versus LET* in Common Lisp