[r6rs-discuss] [Formal] Formal semantics should not contain complicating optimizations

From: Robby Findler <robby>
Date: Thu Mar 15 11:36:37 2007

On 3/15/07, AndrevanTonder <andre_at_het.brown.edu> wrote:
> On Thu, 15 Mar 2007, Robby Findler wrote:
>
> > This is not an "optimization" in the usual sense of the word (altho
> > one could make a case it is a cognitive optimization. Those seem good,
> > however).
>
> First, I suspect it may be incorrect. Doesn't simple substitution destroy the
> correct behaviour of eq?

No.

> Second, I think it is a cognitive complication. It introduces a distinction
> that is never mentioned in the informal semantics, in fact clashing with a
> strict reading of the latter. A newcomer will see applications proceeding
> sometimes in one way and sometimes in another, depending on the presence of
> set! somewhere later in the code. Comparison with the informal description
> will lead to more surprise.
>
> > The rule is split like that to avoid complicating the semantics when
> > no assignments happen. The overall goal is to make it easier to follow
> > along with a reduction sequence and a simple substitution is easier to
> > follow along with than putting the variable into the store and taking
> > it back out again. At least it is in my experience.
>
> This is not obvious to me. Doesn't simple substitution have the danger of
> leading to exponential explosion in size due to unnecessary copying of the
> argument throughout the body? I would think that this would happen for many
> common programs, making them harder to follow.

Substitution is a very simple way to think of function application,
going back to some of our earliest exposure to mathematics in school
(at least in this country).

Robby
Received on Thu Mar 15 2007 - 11:36:32 UTC

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