is the variable name stored in a space somewhere in memory, with the value
20
associated with it?
Probably not.
For example, if you do weapon_damage = 20
, never change the value, just use it for some computation, the compiled method will probably replicate the literal 20
value in the places you would use weapon_damage
.
If weapon_damage
is a binding that changes value many times inside the scope, then it may be represented by a stack-allocated memory block, but you do not worry about GC, and the name you used is probably not stored but replaced by an address in the stack.
In other cases, such the binding may store different types of heap-allocated objects, then maybe that struct is used. However, note that even that struct does not seem to store any “name” of a variable (at least not the one you have given to it in your code).