Am Di., 27. Okt. 2020 um 06:55 Uhr schrieb Alex Shinn <xxxxxx@gmail.com>:
>
> Nitpick: could we use let instead of let*?
>
> Since there are no bindings it doesn't matter, but let is shorter, is generally what let* expands into, and is the typical idiom for "create a new lexical contour."
From a logical point of view, LET* is the better choice for the idiom
"create a new lexical contour". (Apart from that this SRFI is about
and-let* and not and-let.)
Both LET and LET* create a new lexical contour, but LET (when it is
explained in terms of LAMBDA) logically also creates a new activation
frame. LET*, on the other hand, logically creates as much activation
frames as there are bindings, which means LET* without bindings
creates only a lexical contour but no activation frame, at least
logically.
Of course, implementations can choose to implement LET* in terms of
LET, which will always create a, possibly, superfluous activation
frame (that may be optimized away later), but in fact, LET* without a
single binding could be handled completely in the expander without
expanding into any more primitive form. In some sense, the meanings of
LET and LET* without bindings are equivalent up to one beta-reduction.
Therefore, I would like to stick to LET*, which conveys the meaning
more precisely.
Anyway, as Alex already said, it doesn't matter for the semantics of
this SRFI, nor does it restrict an implementer.
-- Marc
PS I just looked into Chez's source code. There, a LET* without
bindings is indeed not expanded in a superfluous LET or LAMBDA but
just creates a lexical contour, which only matters to the expander.