<div>These two forms seem like they ought to generate the same code, but don't:</div><div><br></div><div>  (defun foo ()</div><div>    (when (bar)</div><div>      (baz)))</div><div><br></div><div>  function foo() {</div>

<div>      return bar() ? baz() : null;</div><div>  };</div><div><br></div><div>  (defun foo ()</div><div>    (when (bar)</div><div>      (let ()</div><div>        (baz))))</div><div><br></div><div>  function foo() {</div>

<div>      if (bar()) {</div><div>          return baz();</div><div>      };</div><div>  };</div><div><br></div><div>Although one wouldn't write an empty LET by hand, macros that</div><div>accumulate bindings sometimes emit them. If those macros are</div>

<div>widely used in a program, one can lose quite a few desirable</div><div>'expressionizations' this way. I've committed a patch (see below) </div><div>to tweak the function TRY-EXPRESSIONIZING-IF? into exempting </div>

<div>empty LETs from the nesting heuristic it uses to decide what to</div><div>expressionize. Vladimir, please revise or revert it I did it wrong.</div><div><br></div><div>This came up because I'm trying to port my code to use the</div>

<div>MAYBE-ONCE-ONLY macro introduced in a5cf0df, rather than</div><div>a similar one I wrote. I'll post about that momentarily.</div><div><br></div><div>Daniel</div><div><br></div><div><br></div><div>diff --git a/src/special-operators.lisp b/src/special-operators.lisp</div>

<div>index 0267133..799d70f 100644</div><div>--- a/src/special-operators.lisp</div><div>+++ b/src/special-operators.lisp</div><div>@@ -222,7 +222,8 @@</div><div>               (try-expressionizing-if?</div><div>                (or (ignore-errors (ps-macroexpand x)) x) ;; fail</div>

<div>                (+ score (case (car exp)</div><div>-                          ((if cond let) 1)</div><div>+                          ((if cond) 1)</div><div>+                          (let (if (second exp) 1 0)) ;; ignore empty binding list</div>

<div>                           ((progn) (1- (length (cdr exp))))</div><div>                           (otherwise 0))))))</div><div>         (t t)))</div><div><br></div>