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

From: John Cowan <cowan>
Date: Mon Mar 12 10:15:57 2007

Mikael Tillenius scripsit:

> However in my opinion the following example is bad style:
> >
> >
> >Another use case:
> >
> > (define (fun)
> > (define var1 ...)
> > ... do some calculations or whatever ...
> > (define var2 depending-on-those-calculations)
> > ...rest...)

I, on the other hand, hold it to be good style not to introduce
new names until necessary (in any programming language); and using
defines in this fashion reduces the amount of nesting required,
thus adding to expressiveness.

I am not alone in this view: the more recently devised members of
the Algol family of programming languages, namely C++, Java, and C#,
all allow this style of mid-block declaration. Scheme too belongs
to this family (despite its lexical syntax), and I see no reason
why it should not acquire this facility as well.

I note that Chicken and scsh already support this style.

-- 
John Cowan    http://ccil.org/~cowan  cowan_at_ccil.org
'Tis the Linux rebellion / Let coders take their place,
The Linux-nationale / Shall Microsoft outpace,
We can write better programs / Our CPUs won't stall,
So raise the penguin banner of / The Linux-nationale.  --Greg Baker
Received on Mon Mar 12 2007 - 10:15:49 UTC

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