Asked By : Val
Answered By : babou
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.
Best Answer from StackOverflow
Question Source : http://cs.stackexchange.com/questions/39525