# Changeset 826a67c for doc/papers/general

Ignore:
Timestamp:
Feb 9, 2018, 4:45:41 PM (5 years ago)
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
298ed08
Parents:
92f8e18
Message:

Clarify lvalue/rvalue nomenclature in paper

File:
1 edited

### Legend:

Unmodified
 r92f8e18 a value that does not have a corresponding address is called a \newterm{rvalue} (for right-hand value''), while a value that does have an address is called a \newterm{lvalue} (for left-hand value''). For example, in @int x; x = 42;@ the variable expression @x@ on the left-hand-side of the assignment is a lvalue, while the constant expression @42@ on the right-hand-side of the assignment is a rvalue. In imperative programming, the address of a value is used for both reading and writing (mutating) a value. Despite the nomenclature of left-hand'' and right-hand'', an expression's classification as lvalue or rvalue is entirely dependent on whether it has an address or not; in imperative programming, the address of a value is used for both reading and writing (mutating) a value, and as such lvalues can be converted to rvalues and read from, but rvalues cannot be mutated because they lack a location to store the updated value. Within a lexical scope, lvalue expressions have an \newterm{address interpretation} for writing a value or a \newterm{value interpretation} to read a value. Since pointers and references share the same internal representation, code using either is equally performant; in fact the \CFA compiler converts references to pointers internally, and the choice between them in user code can be made based solely on convenience. By analogy to pointers, \CFA references also allow cv-qualifiers: By analogy to pointers, \CFA references also allow cv-qualifiers such as @const@: \begin{cfa}