[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] library at file level



John Cowan <cowan@x> writes:

> Andy Wingo scripsit:
>
>> The R6RS behavior made more sense to me, FWIW.  (This process is
>> causing me acute attacks of snark, so I do not wish to enter into a
>> discussion about the change, however.)
>
> Well, I'll take the opportunity, then, and say that I always assumed
> that in Scheme, a construct called `let-whatever` introduces names
> that are scoped to the construct.  I was very surprised to hear about
> the R6RS interpretation.

Would it be sensible to specify the behavior of the `let' family of
syntaxes, with regard to this issue, on the basis of `begin'?

That is, if the body of a `let' kind of form consists entirely of
definitions, they are spliced into the enclosing scope; otherwise a
scope is created.

This would also allow series of definitions whose values can use
let-bound identifiers, as in (a useless example):

(let ((x <value>))
  (define a (+ x 1))
  (define b (+ x 2))
  ...)

However, I'm guessing this would be considered quite "dirty".  Or not?
On the other hand, I found the equivalent practice, using `let-syntax',
very useful in a recent piece of code of mine[0]; it drastically reduced
the repetitiveness of a series of definitions.  The only alternative I
can think of which achieves this is to define the macro I used in the
global scope, which would not be very nice.  (When I think of it from a
user-perspective, the same argument applies to the usage of `let' as in
the above example, but I imagine it is quite hard (maybe impossible) to
implement this definition of `let' in terms of R5RS or R7RS-small,
whereas it seems easier for `let-syntax'.)

Regards,
Taylan

[0] FWIW: https://github.com/TaylanUB/scheme-bytestructures
          (procedural.scm, line 241)

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