[r6rs-discuss] [Formal] body should allow mixing declarations with expressions

From: Per Bothner <per>
Date: Sun Mar 11 21:59:55 2007

---
This message is a formal comment which was submitted to formal-comment_at_r6rs.org, following the requirements described at: http://www.r6rs.org/process.html
---
Type: Simplification and enhancement
Priority: Major
Component: Concepts (?)
Version: 5.92
Scheme should allow expressions and declarations to be mixed in
all bodies, not just top-level bodies.
For example:
(define (f x)
    (define y (use x))
    (display y)
    (define z (use x y))
    (display z)
    (use x y z))
This illustrates one use-case: adding debugging commands.
Another use case:
    (define (fun)
      (define var1 ...)
      ... do some calculations or whatever ...
      (define var2 depending-on-those-calculations)
      ...rest...)
Of course this use-case can be handled using an inner let,
but that adds needless nesting and indentation.  The latter,
especially, is often a limited resource.
The semantics are sketched out in the last paragraph of
8. "Expansion process".
This is a simplification, since it makes normal bodies the
same as top-level bodies.
"Programming languages should be designed not by piling
feature on top of feature, but by removing the weaknesses
and restrictions that make additional features appear
necessary."
"the language described in this report is intended to:
... no unnecessary restrictions on how they are composed."
Originally proposed in:
http://lists.r6rs.org/pipermail/r6rs-discuss/2007-January/001333.html
-- 
	--Per Bothner
per_at_bothner.com   http://per.bothner.com/
Received on Sun Mar 11 2007 - 16:13:13 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC