PROGRAMMING PARADIGMS · PART 3 · SESSION 10, BLOCK 2

Static type systems

Block 2. Typing of an imperative language

Léon Gondelman · Aalborg University Copenhagen · 2026

statements and state: a program with effects

a statement has no value: its run changes a state

the state is an environment \(E\): the value of each variable

▶a ← 1;
▶b ← a + 1;
▶a ← a + b

before line 1:   \(E = \emptyset\)

after line 1:   \(E = \{\)\(a \mapsto 1\)\(\}\)

after line 2:   \(E = \{a \mapsto 1,\ \)\(b \mapsto 2\)\(\}\)

after line 3:   \(E = \{\)\(a \mapsto 3\)\(,\ b \mapsto 2\}\)

the semantics relates a statement and an environment to a new environment:

\[ \emptyset,\ \ \eaff{a}{1};\ \eaff{b}{a+1};\ \eaff{a}{a+b} \ \ \redv\ \ \{a \mapsto 3,\ b \mapsto 2\} \]

typing with effects: one type for each variable

what does line 3 add 1 to?

a Boolean in the runs where \(y < 0\), an integer in the other runs

a typing environment \(\Gamma\) gives one type to each variable, for the whole program

x ← 1;
▶if y < 0 then x ← true else skip;
z ← x + 1

with \(\Gamma = \{x \mapsto \mathtt{int},\ y \mapsto \mathtt{int},\ z \mapsto \mathtt{int}\}\):
line 2 is rejected: \(\mathtt{true}\) is not of type \(\mathtt{int}\)

an assignment \(\eaff{x}{e}\) is accepted only if \(e\) has the type of \(x\): the value of a variable changes, its type does not

big-step and small-step semantics

small-step semantics (block 1): one judgment for one step; a run is a sequence of steps

\[ 1 + 2 < 4 \ \step\ 3 < 4 \ \step\ \mathtt{true} \]

big-step semantics, or natural semantics: one judgment for a whole run, from the program to its result

\[ \emptyset,\ \eaff{a}{1 + 2} \ \redv\ \{a \mapsto 3\} \]

runs without a result, in the two semantics

statement, run from \(\emptyset\)big-stepsmall-step
\(\eaff{a}{1 + 2}\)\(E' = \{a \mapsto 3\}\)steps, then the run ends
\(\eaff{a}{1 + \mathtt{true}}\)no \(E'\)stuck: not finished, and no step applies
\(\ewhile{\mathtt{true}}{\eskip}\)no \(E'\)one more step, forever

what is the result of a run that crashes, and of a run that never ends?

big-step gives no result to both; small-step tells them apart

block 2 uses big-step: one rule for each construct, read as an interpreter

Typing of an imperative language

  1. the While language and its big-step semantics
  2. the typing of expressions and statements
  3. type safety of While, stated formally
  4. the lab: semantics and typing of break and continue

a While program

a ← 0;
b ← 1;
while b < 100 do
  b ← a + b;
  a ← b - a

what does this program compute?

\(a\) and \(b\) are two consecutive Fibonacci numbers

the run ends in the environment

\[ \{a \mapsto 89,\ b \mapsto 144\} \]

syntax of the While language

\(e\)\(::=\)expression
\(|\)\(c\)integer or Boolean constant
\(|\)\(x\)variable
\(|\)\(e~op~e\)binary operator (\(+\), \(<\), …)
\(s\)\(::=\)statement
\(|\)\(\eaff{x}{e}\)assignment
\(|\)\(\eif{e}{s}{s}\)conditional
\(|\)\(\ewhile{e}{s}\)loop
\(|\)\(s;~s\)sequence
\(|\)\(\eskip\)do nothing

big-step operational semantics of While

we seek to define a relation between some expression \(e\) and a value \(v\)

\[ e \redv v \]

here, values are limited to integer and Boolean constants

\(v\)\(::=\)value
\(|\)\(n\)integer
\(|\)\(b\)Boolean

caveat: in most languages, values do not coincide with constants (Java)

value of an expression in an environment

in the environment \(E = \{ a \mapsto 34, ~ b \mapsto 55 \}\), the expression \(a+b\) has the value \(89\):

\[ E,\ a+b \ \redv\ 89 \]

an environment \(E\) is a function from variables to values: it gives the value of each variable

the relation \(E,e \redv v\) reads “in the environment \(E\), the expression \(e\) has the value \(v\)”

semantics of expressions

the relation \(E,e \redv v\) is defined by inference rules:

\[ \infr{}{E,n \redv n}\rname{Int} \hspace{3em} \infr{}{E,b \redv b}\rname{Bool} \hspace{3em} \infr{x\in\mathrm{dom}(E)}{E,x \redv E(x)}\rname{Var} \]
\[ \infr{E,e_1 \redv n_1 \quad E,e_2 \redv n_2 \quad n=n_1+n_2}{E,e_1+e_2 \redv n}\rname{Plus} \]
  • each of the other operators has a rule of the form of (Plus)
  • (Plus) applies to integers only: \(1 + \mathtt{true}\) has no rule, and no value

derivation of the value of an expression (example)

with \(E = \{ a \mapsto 34, ~ b \mapsto 55 \}\), we have

\[ \infr{\infr{a\in\mathrm{dom}(E)}{E,a \redv 34} \quad \infr{b\in\mathrm{dom}(E)}{E,b \redv 55} \quad 89=34+55}{E,a+b \redv 89} \]

such a tree is a proof: here, that the expression has the value 89

semantics of statements

a statement changes the value of some variables, through assignments

its semantics is therefore a relation between two environments:

\[ E,s \redv E' \]

it reads “in the environment \(E\), the run of the statement \(s\) ends, in the environment \(E'\)”

semantics of statements: skip, assignment, sequence

\[ \infr{}{E,\eskip \redv E}\rname{Skip} \hspace{4em} \infr{E,e \redv v}{E,\eaff{x}{e} \redv E\{x\mapsto v\}}\rname{Assign} \]
\[ \infr{E,s_1 \redv E_1 \quad E_1,s_2 \redv E_2}{E,s_1;s_2 \redv E_2}\rname{Seq} \]
  • \(E\{x\mapsto v\}\) is \(E\) in which \(x\) now has the value \(v\)
  • in (Seq), \(s_2\) runs in \(E_1\), the environment that \(s_1\) leaves

\(\{a \mapsto 1\},\ \ \eaff{a}{a+1};\ \eaff{a}{a \times 2}\ \ \redv\ \ \{a \mapsto 4\}\)   by (Seq), with \(E_1 = \{a \mapsto 2\}\)

semantics of statements: conditional

\[ \infr{E,e \redv \mathtt{true} \quad E,s_1 \redv E_1}{E,\eif{e}{s_1}{s_2} \redv E_1}\rname{IfTrue} \]
\[ \infr{E,e \redv \mathtt{false} \quad E,s_2 \redv E_2}{E,\eif{e}{s_1}{s_2} \redv E_2}\rname{IfFalse} \]
  • one branch only stands in the premises: the other branch does not run
  • a guard whose value is not a Boolean has no rule: the conditional has no result

\(\{a \mapsto 21\},\ \ \eif{a>0}{\eaff{a}{2\times a}}{\eskip}\ \ \redv\ \ \{a \mapsto 42\}\)   by (IfTrue)

semantics of statements: loop

\[ \infr{E,e \redv \mathtt{false}}{E,\ewhile{e}{s} \redv E}\rname{WhileFalse} \]
\[ \infr{E,e \redv \mathtt{true} \quad E,s \redv E_1 \quad E_1,\ewhile{e}{s} \redv E_2}{E,\ewhile{e}{s} \redv E_2}\rname{WhileTrue} \]
  • the last premise of (WhileTrue) is about the same loop, in the environment \(E_1\) that the body leaves
  • a loop that never ends has no derivation: a derivation is a finite tree

\(\{a \mapsto 0\},\ \ \ewhile{a<2}{\eaff{a}{a+1}}\ \ \redv\ \ \{a \mapsto 2\}\)   by (WhileTrue) twice, then (WhileFalse)

derivation of the run of a conditional (example)

with \(E = \{a\mapsto 21\}\), we have

\[ \infr{\infr{E,a\redv 21 \quad E,0\redv 0}{E,a>0\redv\mathtt{true}} \qquad \infr{\infr{E,2\redv 2 \quad E,a\redv 21}{E,2\times a\redv 42}}{E,\eaff{a}{2\times a} \redv \{a\mapsto 42\}}\rname{Assign}}{E,\eif{a>0}{\eaff{a}{2\times a}}{\eskip} \redv \{a\mapsto 42\}}\rname{IfTrue} \]

the premises \(21 > 0\) and \(42 = 2 \times 21\) of the two operator rules are not drawn

expressions without a value, statements without a result

for some expressions \(e\), there is no value \(v\) such that \(E,e\redv v\)

\(1 + \mathtt{true}\)no rule adds a Boolean

for some statements \(s\), there is no environment \(E'\) such that \(E,s \redv E'\)

\(\ewhile{\mathtt{true}}{\eskip}\)the run never ends
\(\ewhile{(42 + 0)}{\eskip}\)the value of the guard is not a Boolean
\(\ewhile{(42 / 0)}{\eskip}\)the guard has no value

Typing of While

  1. the While language and its big-step semantics
  2. the typing of expressions and statements
  3. type safety of While, stated formally
  4. the lab: semantics and typing of break and continue

types of While

we introduce types, with the following abstract syntax

\(\tau\)\(::=\)type
\(|\)\(\mathtt{int}\)integer values
\(|\)\(\mathtt{bool}\)Boolean values

typing of expressions (the rules of block 1)

\[ \infr{}{\Gamma\vdash n:\mathtt{int}}\rname{T-Int} \hspace{3em} \infr{}{\Gamma\vdash b:\mathtt{bool}}\rname{T-Bool} \hspace{3em} \infr{x\in\mathrm{dom}(\Gamma)}{\Gamma\vdash x:\Gamma(x)}\rname{T-Var} \]
\[ \infr{\Gamma\vdash e_1:\mathtt{int} \quad \Gamma\vdash e_2:\mathtt{int}}{\Gamma\vdash e_1 + e_2:\mathtt{int}}\rname{T-Plus} \hspace{3em} \infr{\Gamma\vdash e_1:\mathtt{int} \quad \Gamma\vdash e_2:\mathtt{int}}{\Gamma\vdash e_1 < e_2:\mathtt{bool}}\rname{T-Less} \]

with \(\Gamma = \{a \mapsto \mathtt{int}\}\):   \(\Gamma \vdash a + 1 < 5 : \mathtt{bool}\) holds;   \(a + \mathtt{true}\) has no type

typing derivation of an expression (example)

with \(\Gamma=\{a \mapsto \mathtt{int}\}\), we have

\[ \infr{\infr{a \in \mathrm{dom}(\Gamma)}{\Gamma \vdash a : \mathtt{int}} \quad \infr{}{\Gamma \vdash 1 : \mathtt{int}}}{\Gamma \vdash a + 1 : \mathtt{int}} \]

this derivation is a proof that a+1 is a well-typed expression

expressions without a type

with \(\Gamma=\{a \mapsto \mathtt{int}\}\), two expressions have no type:

\(b\)\(b \notin \mathrm{dom}(\Gamma)\): (T-Var) does not apply
\(1+\mathtt{true}\)(T-Plus) requires \(\Gamma \vdash \mathtt{true} : \mathtt{int}\)

is anything lost?

no: \(1+\mathtt{true}\) has no value in any environment, and \(b\) has none where only \(a\) has a value

the safety theorem of this block states the link between having a type and having a value

typing judgment for statements

a statement has no value, hence no type: it is well typed, or it is not

the judgment for statements is

\[ \Gamma \vdash s \]

it reads “in the typing environment \(\Gamma\), the statement \(s\) is well typed”

typing of statements: skip, sequence, assignment

\[ \infr{}{\Gamma \vdash \eskip}\rname{T-Skip} \hspace{4em} \infr{\Gamma \vdash s_1 \quad \Gamma \vdash s_2}{\Gamma \vdash s_1;s_2}\rname{T-Seq} \]
\[ \infr{\Gamma \vdash x : \tau \qquad \Gamma \vdash e:\tau}{\Gamma \vdash \eaff{x}{e}}\rname{T-Assign} \]
  • in (T-Assign), the same type \(\tau\) stands in both premises: \(e\) has the type of \(x\)
  • \(\Gamma\) is the same in premises and conclusion: a statement changes \(E\), never \(\Gamma\)

with \(\Gamma = \{a \mapsto \mathtt{int}\}\):   \(\Gamma \vdash \eaff{a}{a+1}\)   but not   \(\Gamma \vdash \eaff{a}{\mathtt{true}}\): \(\mathtt{true}\) is not of type \(\mathtt{int}\)

typing of statements: conditional and loop

\[ \infr{\Gamma \vdash e:\mathtt{bool} \qquad \Gamma \vdash s_1 \qquad \Gamma \vdash s_2}{\Gamma \vdash \eif{e}{s_1}{s_2}}\rname{T-If} \]
\[ \infr{\Gamma \vdash e:\mathtt{bool} \qquad \Gamma \vdash s}{\Gamma \vdash \ewhile{e}{s}}\rname{T-While} \]
  • both branches are checked, where a run executes one of them
  • the body of a loop is checked once, where a run executes it any number of times

with \(\Gamma = \{a \mapsto \mathtt{int}\}\):   \(\Gamma \vdash \ewhile{a < 100}{\eaff{a}{a+a}}\)   but not   \(\Gamma \vdash \ewhile{a}{\eskip}\)

the conditional as a statement and as an expression

we have conditional at the level of statements:

\[ \infr{\Gamma \vdash e:\mathtt{bool} \qquad \Gamma \vdash s_1 \qquad \Gamma \vdash s_2}{\Gamma \vdash \eif{e}{s_1}{s_2}} \]

we could add conditional in the expressions:

\[ \infr{\Gamma \vdash e_1:\mathtt{bool} \qquad \Gamma \vdash e_2 : \tau \qquad \Gamma \vdash e_3 : \tau }{\Gamma \vdash \eif{e_1}{e_2}{e_3} : \tau} \]

what is different, and what is common, in the two rules?

exercises (1/2): typing of pairs

an extension of While with pairs: a constructor \((e, e)\), and the left and right components \(\fst{e}\) and \(\snd{e}\)

1. Define the pair types. Define typing rules for each of the expressions \((e_1, e_2)\), \(\fst{e}\) and \(\snd{e}\).

2. Consider the program

\[ \eif{\fst{x} > 0}{\eaff{x}{(\snd{x},\fst{x} + \snd{x})}}{\eaff{x}{0}} \]

Explain why this program is rejected by the static type system.

exercises (2/2): typing of two more loops

an extension of While with two statements:

\(\mathtt{repeat}~s~\mathtt{until}~e\)   and   \(\mathtt{for}~x=e~\mathtt{to}~e~\mathtt{do}~s\)

3. Define the typing rule for the repeat loop \(\mathtt{repeat}~s~\mathtt{until}~e\).

4. Define the typing rule for the for loop \(\mathtt{for}~i=e_1~\mathtt{to}~e_2~\mathtt{do}~s\).

Type safety of While

  1. the While language and its big-step semantics
  2. the typing of expressions and statements
  3. type safety of While, stated formally
  4. the lab: semantics and typing of break and continue

type safety: the slogan of block 1 (recall)

well-typed programs cannot “go wrong”

- what does it mean formally?

- why does it matter in practice?

- how is type safety enforced?

type safety as progress and preservation

Safety = Progress + Preservation

Progress: a well-typed program is not stuck: either it is a final result or it can take a step of evaluation

Preservation: if a well-typed program takes a step of evaluation, then the resulting program is also well-typed

a formal statement needs a mathematical definition of “step of evaluation”, “final result” and “well-typed”

the need for a formal definition

a type system designed without a proof of safety can be flawed

  • Java and Scala: programs accepted by the type checker that fail with a cast error, found in 2016 (Amin and Tate, OOPSLA 2016)
  • TypeScript: soundness is not a design goal

a proof of safety needs three definitions, each one precise:

  • the syntax: what a program is
  • the semantics: what a program does, and what “going wrong” is
  • the typing rules: which programs are accepted

agreement of an environment with a typing environment

with \(\Gamma = \{a \mapsto \mathtt{int},\ b \mapsto \mathtt{bool}\}\):

\(E_1 = \{a \mapsto 34,\ b \mapsto \mathtt{true}\}\)agrees with \(\Gamma\)
\(E_2 = \{a \mapsto 34,\ b \mapsto \mathtt{true},\ c \mapsto 7\}\)agrees with \(\Gamma\): \(\Gamma\) says nothing of \(c\)
\(E_3 = \{a \mapsto \mathtt{true},\ b \mapsto \mathtt{true}\}\)does not agree: the value of \(a\) is not an integer
\(E_4 = \{a \mapsto 34\}\)does not agree: \(b\) has no value

definition

an environment \(E\) agrees with a typing environment \(\Gamma\), written \(\Gamma \vdash E\), when for every variable \(x \in \mathrm{dom}(\Gamma)\):

  • \(x \in \mathrm{dom}(E)\), and
  • \(E(x)\) is a value of type \(\Gamma(x)\): an integer if \(\Gamma(x) = \mathtt{int}\), a Boolean if \(\Gamma(x) = \mathtt{bool}\)

type safety of While: the theorem for expressions

theorem (safety, expressions)

if  \(\Gamma \vdash e : \tau\)  and  \(\Gamma \vdash E\),  then there is a value \(v\) such that  \(E, e \redv v\),  and \(v\) is of type \(\tau\)

a well-typed expression has a value, and the value is of its type

with \(\Gamma = \{a \mapsto \mathtt{int}\}\) and \(E = \{a \mapsto 21\}\):

\(\Gamma \vdash 2 \times a : \mathtt{int}\)   and   \(E,\ 2 \times a \redv 42\), an integer

the operators are \(+\), \(-\), \(\times\), \(<\), \(>\), \(=\) on integers, each defined for all integers

type safety of While: the theorem for statements

theorem (safety, statements)

if  \(\Gamma \vdash s\)  and  \(\Gamma \vdash E\)  and  \(E, s \redv E'\),  then \(\Gamma \vdash E'\)

a well-typed statement preserves the agreement: when its run ends, every variable of \(\Gamma\) still has a value of its type

with \(\Gamma = \{a \mapsto \mathtt{int}\}\) and \(E = \{a \mapsto 21\}\):

\(E,\ \eif{a>0}{\eaff{a}{2\times a}}{\eskip} \ \redv\ \{a \mapsto 42\}\)   and   \(\Gamma \vdash \{a \mapsto 42\}\)

limits of the safety theorem: a run that never ends

does every well-typed statement have a result?

this statement is well typed, with \(\Gamma = \emptyset\)

its run never ends: no \(E'\) exists

the theorem on statements covers only the runs that end

while true do skip

limits of the safety theorem: division by zero

\(42 / 0\) has the type \(\mathtt{int}\), with \(/\) typed as \(+\), and it has no value

with division, the theorem on expressions fails

the type checkers of OCaml and Java accept this division too: the error is raised at run time

x ← 42 / 0

limits of the safety theorem: progress

progress: “a well-typed program is never stuck”

progress speaks of steps: the judgment \(E, s \redv E'\) cannot state it

a remedy within big-step semantics:
the unwanted end of a run receives a result of its own

the theorem then states that no well-typed program ends with it

the lab does so for a break or a continue outside a loop

The lab: break and continue

  1. the While language and its big-step semantics
  2. the typing of expressions and statements
  3. type safety of While, stated formally
  4. the lab: semantics and typing of break and continue

static typing as a static analysis

a static analysis establishes a property of all the runs of a program from its text alone, without running it

  • a variable read before it is assigned
  • code that no run reaches
  • two threads that write the same variable without a lock (session 7)
  • an operation applied to a value of the wrong type

each of these properties is undecidable in general (by reduction from the halting problem), so an analysis that always answers and never misses an error rejects some correct programs

a type system can also check an effect of a statement, not only the type of a value: in the lab, that break and continue occur only inside a loop

lab: big-step semantics of break and continue

two new statements:

\(s ::= \dots \mid\) \(\mathtt{break}\) \(\mid\) \(\mathtt{continue}\)

the run of a statement now ends with an outcome:

\(\omega ::= \mathtt{normal} \mid \mathtt{broken} \mid \mathtt{continued}\)

the judgment for statements becomes

\(E, s \redv (E',\)\(\omega\)\()\)

x ← 1;
break;
x ← 2

in which environment, and with which outcome, does the run from \(\{x \mapsto 0\}\) end?

to write: the rules of \(\mathtt{break}\) and \(\mathtt{continue}\), three rules for \(s_1; s_2\), four for \(\ewhile{e}{s}\)

lab: typing of break and continue

the judgment for statements carries a flag:

\((\Gamma,\)\(\ell\)\() \vdash s \qquad \ell \in \{\mathtt{true}, \mathtt{false}\}\)

\(\ell\) records whether \(s\) stands inside a loop

a whole program is checked with \(\ell = \mathtt{false}\)

to write: the typing rules of \(\mathtt{break}\), \(\mathtt{continue}\) and \(\ewhile{e}{s}\)

if x > 0 then break else skip
while true do
  if x > 0 then break else skip

which of the two do the rules accept, with \((\{x \mapsto \mathtt{int}\}, \mathtt{false})\)?

the property that the typing guarantees

if  \((\Gamma, \mathtt{false}) \vdash s\)  and  \(E, s \redv (E', \omega)\),  then \(\omega = \mathtt{normal}\)

Appendix

big-step rules: expressions, skip, assignment, sequence

\[ \infr{}{E,n \redv n}\rname{Int} \hspace{2em} \infr{}{E,b \redv b}\rname{Bool} \hspace{2em} \infr{x\in\mathrm{dom}(E)}{E,x \redv E(x)}\rname{Var} \]
\[ \infr{E,e_1 \redv n_1 \quad E,e_2 \redv n_2 \quad n=n_1+n_2}{E,e_1+e_2 \redv n}\rname{Plus} \]

the other operators have a rule of the form of (Plus)

\[ \infr{}{E,\eskip \redv E}\rname{Skip} \hspace{2em} \infr{E,e \redv v}{E,\eaff{x}{e} \redv E\{x\mapsto v\}}\rname{Assign} \hspace{2em} \infr{E,s_1 \redv E_1 \quad E_1,s_2 \redv E_2}{E,s_1;s_2 \redv E_2}\rname{Seq} \]

big-step rules: conditional and loop

\[ \infr{E,e \redv \mathtt{true} \quad E,s_1 \redv E_1}{E,\eif{e}{s_1}{s_2} \redv E_1}\rname{IfTrue} \hspace{2em} \infr{E,e \redv \mathtt{false} \quad E,s_2 \redv E_2}{E,\eif{e}{s_1}{s_2} \redv E_2}\rname{IfFalse} \]
\[ \infr{E,e \redv \mathtt{false}}{E,\ewhile{e}{s} \redv E}\rname{WhileFalse} \]
\[ \infr{E,e \redv \mathtt{true} \quad E,s \redv E_1 \quad E_1,\ewhile{e}{s} \redv E_2}{E,\ewhile{e}{s} \redv E_2}\rname{WhileTrue} \]

typing of While: all the rules

\[ \infr{}{\Gamma\vdash n:\mathtt{int}}\rname{T-Int} \hspace{3em} \infr{}{\Gamma\vdash b:\mathtt{bool}}\rname{T-Bool} \hspace{3em} \infr{x\in\mathrm{dom}(\Gamma)}{\Gamma\vdash x:\Gamma(x)}\rname{T-Var} \]
\[ \infr{\Gamma\vdash e_1:\mathtt{int} \quad \Gamma\vdash e_2:\mathtt{int}}{\Gamma\vdash e_1 + e_2:\mathtt{int}}\rname{T-Plus} \hspace{3em} \infr{\Gamma\vdash e_1:\mathtt{int} \quad \Gamma\vdash e_2:\mathtt{int}}{\Gamma\vdash e_1 < e_2:\mathtt{bool}}\rname{T-Less} \]
\[ \infr{}{\Gamma \vdash \eskip}\rname{T-Skip} \hspace{3em} \infr{\Gamma \vdash s_1 \quad \Gamma \vdash s_2}{\Gamma \vdash s_1;s_2}\rname{T-Seq} \hspace{3em} \infr{\Gamma \vdash x : \tau \qquad \Gamma \vdash e:\tau}{\Gamma \vdash \eaff{x}{e}}\rname{T-Assign} \]
\[ \infr{\Gamma \vdash e:\mathtt{bool} \qquad \Gamma \vdash s_1 \qquad \Gamma \vdash s_2}{\Gamma \vdash \eif{e}{s_1}{s_2}}\rname{T-If} \hspace{3em} \infr{\Gamma \vdash e:\mathtt{bool} \qquad \Gamma \vdash s}{\Gamma \vdash \ewhile{e}{s}}\rname{T-While} \]

values and addresses in Java (example)

in Java (or Python, OCaml, etc.), a value may be an address, even if we do not have addresses among the literal constants of the language

int[] a = new int[4];
...
int[] b = a;
b[2] = 42;
...
a b 0 1 2 42 3