FOO, BAR = 1, 2
FOO # => undefined constant FOO
This was fixed after being reported reported in #958 but it's failing again with a different error message.
Good catch. I will remove this "feature" from the language
@asterite i agree with you. Removing this will be better 馃憤
Why remove it?
Because this:
FOO, BAR = 1, 2
Is equivalent to this:
tmp1 = 1
tmp2 = 2
FOO = tmp1
BAR = tmp2
Multi-assign is expanded this way to make this possible:
a, b = b, a
and you need to store the right-hand side in a temporary variable first.
But that doesn't work with constants, because constants don't have access to local variables, they have their own scope.
I also think that this actually makes the code a bit harder to read. And constants are used much less frequently than local variables. We _could_ change the rule and simply assign values one by one in a multi-assign, just for constants, but I'm not sure it's worth it. So the easiest thing to do is to remove this from the language.
Most helpful comment
Because this:
Is equivalent to this:
Multi-assign is expanded this way to make this possible:
and you need to store the right-hand side in a temporary variable first.
But that doesn't work with constants, because constants don't have access to local variables, they have their own scope.
I also think that this actually makes the code a bit harder to read. And constants are used much less frequently than local variables. We _could_ change the rule and simply assign values one by one in a multi-assign, just for constants, but I'm not sure it's worth it. So the easiest thing to do is to remove this from the language.