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

NAMED-LAMBDA, REC, DEFINE



In the spirit of fanatic minimalism, I would prefer to
remove both NAMED-LAMBDA and REC.  

    From: Chris Hanson
    Re: prefering LETREC in the expansion of (DEFINE (FOO ...) ...)

    I claim (and I believe that there will be support for this claim) that
    the INTENT of the author of such a self referential procedure was that
    the name FOO refer to the procedure itself, not the binding of the
    variable FOO. This is because the binding is normally assumed to be
    fixed; interactive definitions are something that the language has
    because we recognize the need for debugging and evolution of our
    programs.  

I agree (except that I think of redefinition as provided by the
development environment, not the language).

               And the more naive the user, the more confusing it will be
    if the procedure FOO depends on the value of the variable FOO, rather
    than meaning "self reference".

I am not convinced that introducing self references behind the naive user's
back is doing him or her a great service.  LETREC-introducing DEFINE
provides what you consider to be the intuitive behavior only in the simple
case.  E.g.:  

 (DEFINE (FOO N) ...(FOO...)...)
 (SET! BAZ FOO)
 <subsequent redefinition of FOO>

the value of BAZ will be "consistent" because BAZ is the old version of
FOO, and the old version of FOO will recur by calling the old version.  
But, in this case:

 (DEFINE (FOO N) ... (BAR N) ...)
 (DEFINE (BAR N) ... (FOO N) ...)
 (SET! BAZ FOO)
 <subsequent redefinition of FOO and BAR>

the value of BAZ will be inconsistent because the old version of FOO will
call the new version of BAR, which will call the new version of FOO.  

Of course, a novice can still achieve confusion when defining and
redefining procedures using the simple DEFINE syntax.  Furthermore, you
have to explain the difference between variable references that are self
references and those that are not.