7
$\begingroup$

I read that Name binding assigns some value (data/code/expression) to an identifier. Assignment and valuation seem to do the same thing. It is confusing. Can I just tell that free variable is one, which was not assigned a value whereas bound variable has its value assigned?

$\endgroup$
6
$\begingroup$

Binding has to do with giving names to things (or values) in a given well delimited context. Assignment is about storing things (or values) in some location (a variable). Another assignment can replace a previous value with a new one. Valuation consist in binding all the identifiers of a formal text with something (with a value). In mathematics these identifiers are often called variables, which causes a confusion with the concept of variable (i.e. memory storage) in computer science.

Trying to give more intuitive details

Name binding attaches a meaning to identifiers within some part (called scope) of the concerned mathematical or programming text. This meaning can indeed be seen as a value in some domain when the text is interpreted.

For example, if you declare foo as an integer variable, the value attached to foo within the scope is an integer variable. An integer variable may be seen informally a a container that can carry an integer value, which may be changed. You can also see it as the address of a place in memory where the content may be stored.

But if you declare foo as the integer 25, then whithin the scope, any use of foo is identical to a use of 25. If you declare foo as an integer constant, it cannot change and thus its value must be specified.

Binding is attaching a name to some value that does not change within the scope of the name. An example is a legal documents stating that "for the purpose of this document, Mr. Brown, and the Smith family shall be called the beneficiary." The scope is the legal document. And everywhere in the document, the use of the word beneficiary means Mr. Brown, and the Smith family. You can see it as a definition of a local terminology. It has to do with giving names to things. Binding is about speaking, reading or writing. It is not about executing or moving values around: that corresponds to assignment.

A variable may be seen as a chunk of memory that can contain a value, When you have a variable, you can change the value contained in this variable contains with an assignment. If foo is bound to (or denotes) a variable in the current scope, you can assign a value to foo, i.e. to the variable denoted by foo, or read the value contained in that variable. And you can change that value with a new assignment.

So binding is an operation that tells what is the meaning of names in the text of the program or of the mathematical discourse. It is static, in the sense that the text does not change. But assignment is a programming concept that consist is storing a value in a variable, i.e. a container, which is usually a place in memory. It is a dynamic concept related to how (representations of) values are stored in memory, which changes as the program progresses.

Note that a variable may exist independently of any name to which it could be bound. This is the case for an element of an array, to take a simple example.

In various contexts, one may consider expressions or texts that use names that have not been defined. For example you can write $(a^2-b^2)/(a-b)$ which is an arithmetic expression. Then you may valuate the variables by associating an environment (you may read approximately a scope) where the variables $a$ and $b$ are bound to some values, for example 3 and 12, and be interested in the value taken by the exression. A valuation is such an association of a set of names, each with a specific value. The name valuation is used more in formal mathematics, while assigment is a programming concept.

$\endgroup$
  • $\begingroup$ To summarize, you basically confirm that all operations assign a value to variable/identifier/placeholder. The difference is the context. When we map guest (program) to host (machine), we say binding. When variable is bound to some value during program execution, we say it was assigned and we prefer to say valuated in the formal/cs context instead. I just started to look at the free/bound variables today and confused. It is like formal/cs context, yet, compiler/computer engeneer jargon is used? $\endgroup$ – Val Feb 18 '15 at 15:33
  • 2
    $\begingroup$ @RecognizeEvilasWaste I have attempted to clarify. But there is a difficulty due to the fact that mathematical terminology conflicts with computer science terminology. A variable cannot be bound to some value, a variable is assigned a value. An identifier is bound to a meaning, but the formal notion of meaning is some value in a semantics domain. You do not assign identifiers, you do not bind variables. Identifiers are syntax, speech. Variables are memory, used to store information. Actually, it is computer jargon that was derived from the formal speech. $\endgroup$ – babou Feb 18 '15 at 16:37
  • 2
    $\begingroup$ Your confusion is understandable. In lambda calculus, the word variable is used for what I call identifier. More generally, there is a whole branch of programming, called functional programming, that is not supposed to use assignment. So, in principle everything is done through binding, but it gives a very different style of programming. Lambda calculus is the basic formal example of that. However, they still talk of variables for what is identifiers. You question is fair, and the terminology is messy. Well I did my best. $\endgroup$ – babou Feb 18 '15 at 17:27
  • $\begingroup$ @RecognizeEvilasWaste Your question is actually a very good one. I had not realized how much ambiguity this creates for beginners. $\endgroup$ – babou Feb 19 '15 at 12:10
  • $\begingroup$ Not only for novice. I would say that I am quite experienced in these issues. I can understand what they mean. But I always have difficulty which term to use when I want to say similar things. I also like to see the relationships between things, en.wikipedia.org/wiki/User:Javalenok This helps understanding. $\endgroup$ – Val Feb 19 '15 at 13:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.