Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

For example, in functional languages, variables are single assignment and their values are immutable once assigned. So they have two states unbound and bound, once bound they can't be changed.

Is there some mathematical term or other computer science term that is most appropriate for such as thing? Something that semantically doesn't imply variance or mutability.

If not there doesn't exist such as term and if you were designing a language that had such constructs, what other than the word variable would you use to for these?

I am not really looking to poll for ideas, I am trying to figure out if there is already an accepted industry ( any industry ) term for such a thing.

share|improve this question
1  
Just call them immutables ;) –  Oded Mar 5 '12 at 17:00
    
final variable? –  smp7d Mar 5 '12 at 17:08
7  
The mathematical term for these kinds of variables would be "variable". The concept of a mutable variable didn't really exist until programming languages entered the picture. –  sepp2k Mar 5 '12 at 17:40
add comment

7 Answers

up vote 3 down vote accepted

What about "symbol"?

I saw a video on F# where the speaker said,

you do not assign a value to a variable, you bind a value to a symbol.

(Still looking for the reference for this.)

Whenever I encounter the word "variable" in places where such constructs are immutable, I silently think "bound symbol."

share|improve this answer
add comment

Just call them variables. Math has variables; functional languages have the same kind of variables.

See also this essay by Bob Harper on this terminology issue.

share|improve this answer
    
While this is along the lines of what I was looking for, the provided link, just stirs up more debate than answers. –  Jarrod Roberson Mar 5 '12 at 20:07
    
@JarrodRoberson, just take the linked essay as "why variable is an appropriate term"; feel free to ignore the part about "assignables". –  Ryan Culpepper Mar 5 '12 at 21:16
1  
yeah, the assignables is kind of a red-herring in that discussion. But personally I am still semantically stuck on the vary part of variables and that fact that computer science isn't a 100% direct correlation to math terms in lots of cases. –  Jarrod Roberson Mar 6 '12 at 13:44
add comment

It's still a variable if it can take on various values in different invocations. In other words, even though it can't be changed once assigned, that symbol can be assigned to different values initially. That's in contrast to a constant which contains the same value every time it is invoked.

share|improve this answer
add comment

constant, or const would probably be familiar to people using languages such as C and C++,

share|improve this answer
add comment

Why not just stick with that term? It may not be 100% appropriate, but when you choose a different name that will probably a cause of more misunderstandings than the ones you try to solve. Designers of other functional languages may had the same problem, but they decided to use the term "variable", either.

XSLT (which is widely used):

http://www.w3schools.com/xsl/el_variable.asp

Haskell:

http://www.haskell.org/onlinereport/haskell2010/haskellch3.html#x8-240003.2

Scheme:

http://www.scheme.com/tspl2d/binding.html

Erlang:

http://www.erlang.org/doc/reference_manual/expressions.html

All of them are using the term "variable", too.

Of course, other language designers prefer to talk of "bindings" or "bound values", like here for F#:

http://msdn.microsoft.com/en-us/library/dd233238.aspx

share|improve this answer
add comment

Depending on the contex "variable" or "binding" would work. I think "binding" is more likely to come up in statements like let in Haskell or Lisp.

share|improve this answer
add comment

Name. The same thing may be reasonably called by multiple names (x = 4; y = 4); and a name, once defined, never changes its referent. x = 2; x = 3 makes just as little sense as saying that an octopus is not an octopus.

share|improve this answer
    
I like this, I was considering the term label but name works just and well if not better. –  Jarrod Roberson Mar 11 '12 at 5:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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