A
ReferenceValue is a special type of value in programming languages that allow side effects and are based on the environment model.
The essential property of a
ReferenceValue is that it both
is a value and
can have a value, and it can
have different values at different times.
The property enables stateful computation.
The operation of making a
ReferenceValue denote a new value (which can be another
ReferenceValue) is called
assignment.
The operation of obtaining the value that a
ReferenceValue denotes is called
dereferencing, and in most language one level of dereferencing is implicit, except on the left hand side of the assignment operator and in other distinguished cases.
But there have been languages like the
BlissLanguage where all dereferencing had to explicitly notated, for example as in (the dot is the dereference operator):
a = .a + 1
NOTE: operators like $ or @ in the
PerlLanguage are not dereferencing operators, they are operators on
strings, and they are property lookup operators for the atom named by the following string, as in the
LispLanguage.
Pointers are usually implemented as a
ReferenceValue, and variables are usually implemented as a manifestly named constant
ReferenceValue.
In many languages, those that have
StaticTyping, a
ReferenceValue may be associated with a constraint as to the values it can denote. This allows for several optimizations, as well as being of documentary value.
This all means that a common definition like
auto int i;
is really a shorthand for something like:
manifest i == auto new reference;
ensure typeof(valueof i) == int;