[plt-scheme] to define, or to let

From: Paul Graunke (ptg at ccs.neu.edu)
Date: Tue Mar 23 00:20:12 EST 2004

I've been trying to ignore this thread, so I apologize if I'm repeating
something already said.  Maybe I should have kept ignoring it since
my comments are probably not going to change anything anyway.

I just want to say that I do not understand why anyone would want
to program in a language without a well-defined meaning for each
program.  There are plenty of "more efficient" languages
(not that a *language* could be efficient or inefficient) out there
than Scheme where programs exhibit ambiguous, compiler-dependent
behavior.  Sure, some compilers may produce faster code.  Some
compilers may produce code that consumes more or less memory.
Being able to reason about these implementation details is
important to some degree, but I would much rather know that
my program will either
    1) take too long
    2) exhaust memory
or 3) produce the answer as given by the semantics
than have my program produce the wrong answer.
Adding diverge or raise an exception to the above list would still
leave me happier than producing random stuff.

Also, trying to debug you code with optimization turned off or
extra print statements that mess up the optimizer and having everything
work fine and then removing the debugging flags and/or print statements
only to see the program cease to function properly is really quite 

When crap like that happens, one can blame the programer.  Someone
I know told me he always writes his code in ANF to avoid this problem.
Sure, one can claim that a programmer should write only code that
is independent of evaluation order (baring time and space consumption).
The question I have then is, how can I tell?  Did I write my code
so that it is independent of evaluation order, or did I mess up?
If the compiler writer cannot write a static analysis that can tell,
how am I supposed to know?  An alternative to analysis is methodical
construction---i.e. write your programs in ANF or CPS so they
pin down the order explicitly.  If one argues that this is the
only reasonable way (or the most reasonable way) to write code,
then design a subset of scheme that accepts *only* programs in
that form.  *Any* time a programmer has to maintain a complex
invariant that depends on code scattered across the source base,
it is always helpful to have the *system* enforce, check, or
maintain the invariant for you.  Just think about memory management.
Wait, never mind.  I don't think I want to hear it.


Paul "don't know how to change people" Graunke

Revelation 22:11

Posted on the users mailing list.