[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Scheme Digest #106



One crucial problem with DEFINEs placed willy-nilly in programs arises from
DEFINE's being an environment mutator.  Consider this modification to our
standing example:

(define (foo bool)
   (if bool
        (define (result) #t)
        'do-nothing
   (result)))

Allowing DEFINEs everywhere gives us a weird sort of dynamic scoping.
Restricting DEFINEs to beginnings of blocks allows us to think of a block
of internal DEFINEs as a LETREC (though CALL/CC may expose implementations
that don't implement these blocks as a LETREC).  If Scheme is a statically
scoped language, then this sort of DEFINE is anathema.  If Scheme is to
support dynamic scoping, then I think FLUID-LET is cleaner because I don't
have to think about environment mutation.

Top level DEFINEs don't bother me so much because I think of the top level
as a debugger.

-Mark A. Sheldon