On page 77 (section 6.1) of Types and Programming Languages by Benjamin C. Pierce (1st and only edition thus far), there is the following quote regarding naming contexts and de Bruijn indices:
Γ = x ↦ 4, y ↦ 3, z ↦ 2, a ↦ 1, b ↦ 0
Then x (y z) would be represented as 4 (3 2), while λw. y w would be represented as λ. 4 0 and λw.λa.x as λ.λ.6.
In the second example how do we distinguish between the free variables 0 and the bound variable zero if there were a free variable b in the same term? For instance, it seems like λw. b w would have the name less term λ. 0 0, but this appears ambiguous to me. Maybe I missed something or haven't read far enough ahead.