[plt-scheme] Re: to define, or to let
Bill Richter wrote:
> That's what I'm missing, Anton. Did I miss a long discussion? I like
> left-to-right eval, but why is a fixed order of evaluation safer?
Some folks like it because it behaves predictably or intuitively when
you do use side effects (intentionally or not). Some folks like it
because it's what newbies seem to expect. Some folks like it because
it's easier to write formal proofs for programs with a known, fixed
order of evaluation.
I personally prefer to use sequential constructs (e.g., LET*) only when
I really need them, and to use non-sequential, non-concurrent constructs
(e.g., LET) the rest of the time, because that approach does a better
job of encoding the program's design decisions (which include things
like sequentiality).
> Maybe it's safer to be forced to code so that order of evaluation
> doesn't matter. Taking this to the extreme, we get functional
> programming, which everyone likes!
Heh, that's my feeling on it.
> What's this semantic ambiguity:
>
> letrec [with guaranteed left-to-right evaluation order for its
> initializers] with does not suffer from the semantic ambiguity
> which Matthias is concerned with.
The "ambiguity" is the part where you don't necessarily know what order
the compiler will use to lay out evaluations.
--
Bradd W. Szonye
http://www.szonye.com/bradd