[plt-scheme] about letrec and continuation : which behavior is correct ? and why ?

From: Joe Marshall (jmarshall at alum.mit.edu)
Date: Thu Aug 21 00:25:43 EDT 2008

On Wed, Aug 20, 2008 at 7:41 PM, Eli Barzilay <eli at barzilay.org> wrote:
> On Aug 20, Matthias Felleisen wrote:
>> On Aug 20, 2008, at 2:27 PM, Joe Marshall wrote:
>> > Which, frankly, is a better way of writing this than the letrec
>> > because it is obvious that some side-effecting is going on in
>> > order to create magic circular structure such that
>> > (eq? x ((car x))) could evaluate to #t.
>> Amen.
> (negated Amen).

Eli, what's wrong with you?!  Are you sure you're feeling ok?

> Not only do I like not doing an explicit side effect -- I'd go further
> and merge the `shared' functionality into `letrec', just to make it
> *really* usable for data too.

The thing I *really* want is for there to be a subset of Scheme
that supports pure functional programming where it is obvious,
by cursory inspection, that there are no side effects.  No explicit
calls to SET! (or set-car!, rplaca, etc.) means no side effects
period.  R5RS didn't have this because it required letrec to expand
into let + set! whether it needed it or not.  I was hoping that
R6RS would improve on this by at least *allowing* an implementation
to use a fixed-point if possible.

The more I program, the more I get the feeling that the case against
side effects is vastly understated even by the people that object
the most to them.


Posted on the users mailing list.