views:

101

answers:

6

Is there an accepted general term that subsumes the concepts of variables, class instances and arrays? Basically "any typed thing that needs memory". In C++, such a thing is called an object, but I'm looking for a more language-agnostic term.

§ 1.8 The C++ object model

1 The constructs in a C++ program create, destroy, refer to, access, and manipulate objects. An object is a region of storage. [...] An object can have a name (Clause 3). An object has a storage duration (3.7) which influences its lifetime (3.8). An object has a type (3.9).

A: 

It's called a data member.

aaron
A: 

Does Object not suit your needs? - I think of "Object" as an abstract idea... a variable that contains data (and thus memory) the structure of which is either unknown or irrelevant.

scunliffe
In my mind, in languages such as Java, a variable (other than a primtive such as int) does not contain data, it references it. Two variables could reference the same object state.
djna
That's because Java is a terrible language. :PSeriously, the reference itself is a valid object. Java just separates user-defined objects from language-defined objects.
DeadMG
+1  A: 

Your examples all have some things in common, they have a name that one references in a programming language and some corresponding bits in some memory somewhere. But the model of the meaning of that relationship is very tied to the specific language that you are using.

I think that's why a single vocabulary such as "variable" or "class instance" will not be consistent across languages. In my mind there's quite a distinction between even those two terms in C++.

djna
+4  A: 

In languages where most/all things are "first class," such as Lisp or Lua, this would be called a "value."

Doug Currie
And in other kinds of langauge? I think that there in no widely used language-agnostic term.
djna
@djna I think the problem is that it is good to abstract from the memory model for a language (I am not talking GC, but address modes etc) and therefore many general terms do not depend on the memory. I guess you won't get further than value or variable.
Gabriel Ščerbák
+2  A: 

For instance: "Data entity" or "Information entity".

Maybe one could only say "entity" but for me that sounds way too abstract. "Data..." or "information..." adds at least a bit minimum context. "Entity" is separated from "Operation" (functions, procedures, methods) or "Relationship".

Well, no clue, if this is generally accepted.

(But in the end I feel "Entity" only to be another word for "Object", perhaps just without the immediate association to object-oriented programming.)

Slauma
+1  A: 

The C99 spec uses the word "object", despite C not being an object oriented language. Section 3.14 defines 'object' as a 'region of data storage in the execution environment, the contents of which can represent values'.

Ken
In C++ it also has nothing to do with OOP.
Gabriel Ščerbák