I have found it useful to define local labels at positions where they'd get assigned to a different non-local label usually. This already works in all current NASM versions, both with actual labels and with equ. Here is an example of this:
function.loop:
; do something
function:
; test something
jnz .loop
retn
I'd prefer this to be a documented feature so I can reliably rely on it.
Under the hood, the "function.loop" label becomes a plain
non-local label, rather than one that is local to "function" --
your code works because the lookup for ".loop" notices the
leading ".", and thus looks for "function.loop" -- local or not.
The manual already says in section 3.9:
"the first definition of .loop above is really defining a
symbol called label1.loop, and the second defines a
symbol called label2.loop"
It could be updated to be more specific.
Attached find an abbreviated sample which illustrates what
labels get defined under the hood.
Okay, so actually a non-local label with a dot can be refered to as if it was a local label. (With the effect that labels local to this label can still be created.) As you said, this could be explicitly explained in section 3.9.