Language-agnostic term for typed things that need memory
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 mode开发者_StackOverflow社区l
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).
In languages where most/all things are "first class," such as Lisp or Lua, this would be called a "value."
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.)
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++.
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'.
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.
It's called a data member.
精彩评论