I've read on twitter from @16kbps "why doesn't asm have local aliases for registers". And I thought - "well, how hard can it be?".
Turns out the first quick hack is about an hour hard.
The result is this patch below to nasm (latest git version from https://repo.or.cz/w/nasm.git, that allows you to do stuff like:
%rdefine foobar_test ax mov foobar_test, 1 # mov foobar2_test, 2 %rdefine foobar2_test ax # mov foobar_test, 3 mov foobar2_test, 4
The resulting assembly is:
mov ax, 1 mov ax, 4
Uncommenting either of the two commented lines will cause the compile error, which is a nice side effect.
TODO: make it clear out on branch/call.