Re: Global variable

Subject: Re: Global variable
From: "Frank A. Christoph" <christo@xxxxxxxxxxxxxxxxxx>
Date: Tue, 2 Mar 1999 12:20:38 +0900
>You can calculate and bind values to variables (a bit of a misnomer since
>they can't vary!) within a given (let) scope, you can bind a fixed value to
>a top level variable, but you can't change the value of a variable once bound.

I can't resist replying to your appalling suggestion that "variable" is a misnomer here. This contradicts at least 400 years of a mathematical practice. If anything, it is the use of the word "variable" in imperative programming languages like C that is misleading (not because C variables aren't variables, but because they are much more sophisticated than plain old everyday variables).

A variable in the mathematical sense most certainly _does_ vary; it varies over its domain of values. It is the _denotation_ of such a variable that does not vary, i.e., its meaning, what it refers to. If I write, for example,

(define x 6)

then I am saying that 1) x is a DSSSL variable, and hence it varies over the set of DSSSL values, and 2) its _value_ happens to be the constant, 6. 

The fact that x is a variable, not a constant, is evident from the semantics of DSSSL expressions, which dictate that I can substitute the value of x for any occurrence of x without changing the meaning of enclosing expressions (well, not really, but for the most part this is true). The definition above expresses the fact that x = 6; consequently, for any expression E in the scope of this definition, I can substitute 6 for x in E, written E[6/x], and be assured that E = E[6/x] because x = 6. For example, (+ x x)[6/x] = (+ 6 6) follows from x = 6 which follows from (define x 6) being in (the nearest) scope. More generally, this is known as Leibniz's law of substitution of equals (for equals).

--FC

I$??Ëb?ú?Ö«r¯zm§ÿðÃ	®?·«¯+^r(?÷l²ÉvË,?+-
Current Thread
  • Global variable
    • J-P Theberge - Mon, 1 Mar 1999 10:52:35 -0500 (EST)
      • <Possible follow-ups>
      • Frank A. Christoph - Mon, 1 Mar 1999 22:27:25 -0500 (EST) <=