!undefined_variable is translated to "undefined_variable == false" where undefined_variable is then translated to "undefined_variable" and hence the result is always false.
One solution is separate string and identity, and stop defaulting identity to string literal.