Re: [Scheme-reports] 4.2.2. binding constructs Ray Dillinger 21 May 2011 23:42 UTC

On Thu, 2011-05-19 at 13:18 -0400, John Cowan wrote:
> Andy Wingo scripsit:
>
> > The `let' documentation denotes BODY as "a sequence of one or more
> > expressions".  This does not permit definitions.
> >
> > Similarly for letrec and letrec*.
>
> Fixed.

Honestly, I think that there is an underlying concept here
in terms of which this should be explained.

The underlying concept is that BODY, up to the closing paren,
is something called a "binding contour" -- a contiguous region
of the code in which the bindings established by the let clause
are visible.  let* on the other hand establishes a series of
nested binding contours, one for each variable defined in the
let*, beginning from each definition and extending to the
closing paren after the body.

This is a useful concept because much can be explained in terms
of it in a very consistent way.  We can say, for example, that
any binding contour may begin with definitions, that the scope
of each definition is the entirety of the binding contour in
which it occurs, that lexical scoping in Scheme is accomplised
via the proper nesting of binding contours, and several other
interesting properties.

Also, a general concept of binding contours and what the anatomy
of a valid binding contour may contain would, hopefully, help
to avoid making omissions like the above.

					Bear

_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports