[plt-scheme] RE: to define, or to let

From: Anton van Straaten (anton at appsolutions.com)
Date: Tue Apr 13 04:54:01 EDT 2004

ifconfig wrote:
> I have seen in this thread talk about knowing which function has and which
> doesn't have side effects, and prohibiting use of side effects in
> non-sequencing constructs! This is not wanted behavior

Any prohibition like that would need to be more focused anyway - prohibiting
side effects in all non-sequencing constructs would have a big impact on
Scheme, in the kind of case you mention, and elsewhere.

I raised the C++ case, of annotating methods as not side-effecting their
objects, as an example of the kind of thing that is needed to deal with this
issue statically, since Bill asked about that.  At this level, the
discussion is very hypothetical.

However, in a hypothetical Scheme with greater control over side effects,
there are all sorts of ways you could restrict as well as allow side
effects.  For example, debugging output could be allowed even in otherwise
side-effect free code, since the order in which debugging output procedures
are called doesn't matter, if the code from which it is called doesn't
depend on evaluation order.

BTW, the debugging display example is a case where under unspecified
evaluation order, the program has two possible meanings (if you count the
sequence of output as part of its meaning), but where this is perfectly
acceptable behavior.  These semantics can't be expressed under fixed
evaluation order, without explicitly introducing a random choice (similar to
'permute' in the R5RS semantics).


Posted on the users mailing list.