4

What programming language introduced the word "field" to describe what we might call a member variable in C++? What modern programming languages carry on this usage as the preferred term?

I've seen this word used in both a C and C++ context but it always feels a bit foreign. I don't have a copy of the C standard, but the C++ standard uses the phrase "member variable". (It does use the word "field" in the phrase "bit-field".) Whenever I hear this I can't help but wonder where the speaker got that word from.

  • 1
    Actually, fields aren't called member variables in C++. They're called data members. – fredoverflow Jan 18 '15 at 20:43
  • @FredOverflow I see both "data member" and "member variable" used in the standard. What is the difference? It seems like data member is the more general term. I see it used in reference to union members and static variables for example. – Praxeolitic Jan 18 '15 at 20:48
  • After looking through the standard a bit more, it looks like "member variable" is almost only used when contrasting with a non-member variable. – Praxeolitic Jan 19 '15 at 2:36
  • That makes sense. – fredoverflow Jan 19 '15 at 9:22
7

Field is used in Eiffel, Java, C#, and VB.NET. In Smalltalk and some of its descendants and languages inspired by it (e.g. Ruby), it is called instance variable, in Self and languages inspired by it (Newspeak, Io, Korz), it is called slot. Simula and Python call it attribute (which means something else in C# and something yet different in Ruby), ECMAScript calls it property (which is of course something else in C#), C++ calls it member variable.

So, the term "field" does not come from one of the OO pioneer languages (Simula or Smalltalk). Eiffel predates Java and C#, so at least of all the languages that I am personally familiar with, Eiffel is the one which is most likely to be the origin of the term.

However, it does seem to be a rather obvious term, in analogy to fields on a form.

6

The concept / use of field, a logical part of any data, has been with us since at least punched cards/tape. These fields were typically fixed length.

All of the first languages probably used the term since they were processing punched cards / tape. I say 'probably' because I used 'All' and did not program using them all. In the late 60's when I started programming the term 'field' was used in all of the languages I programmed in.

My guess would be that the first use of 'field' in a programming language would be an early IBM assembler, perhaps SPS.

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.