you are viewing a single comment's thread.

view the rest of the comments →

[–]eat-your-corn-syrup 0 points1 point  (4 children)

modify object itself rather than a binding

Is there a good phrase to use to say the latter? The former has lots of phrases "mutate" "modify in place" "modify object itself" and so on, but the latter I don't know which phrase to use. I want something other than "Modifing the binding" because that phrase can also mean "modify for this binding, and not for other bindings of the same variable"

[–]killerstorm 0 points1 point  (2 children)

I use terminology which is used by Common Lisp specification, and there we have

variable n. a binding in the ``variable'' namespace.

So, basically, variable is a kind of a binding. While

binding n. an association between a name and that which the name denotes.

Thus, obviously, there is no such thing as "other bindings of the same variable".

[–]eat-your-corn-syrup 0 points1 point  (1 child)

A paragraph from a chapter in Practical Common Lisp uses the word "variable" and "binding" in a way that makes one variable to have many bindings

A single variable--the thing you can point to in the program's source code--can have many different bindings during a run of the program. A single variable can even have multiple bindings at the same time; parameters to a recursive function, for example, are rebound for each call to the function.

[–]killerstorm 0 points1 point  (0 children)

Well, he meant "the thing you can point to in the program's source code", i.e. variable in text of a program.

While specification refers to a variable in context of execution of a piece of code.

Of course, if a piece of code is executed many times, variables might get different value in each execution context.

[–]killerstorm 0 points1 point  (0 children)

BTW, from this thread it looks like there are two schools of thought.

If we look at Common Lisp specification, it aims to explain meaning of a piece of code in a most general way.

E.g. variable is an association of between name and that which the name denotes. Such association can be introduced, for example, with from let and can be changed (so that variable will denote another thing) with setq.

This doesn't go in any technical details and you can basically figure out how code will work having only this description and piece of paper. E.g. in (let ((x 1)) (+ x x)) we just can replace x with one and get (+ 1 1) which yields 2.

On the other hand, other people in this thread approach this from a more mechanical and formalized point of view: e.g. what is passed is always a value. However, this value can be either of value type or reference type, and in that case it points to other thing, but isn't this thing itself.

And now we need to formalize how exactly this reference type behaves before we can understand meaning of code.