Actions
Bug #6067
closedConditional assignment of a nested constant raises a SyntaxError
Bug #6067:
Conditional assignment of a nested constant raises a SyntaxError
Description
I can conditionally assign a simple constant:
$ ruby -v -e 'p X ||= 1'
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin10.8.0]
1
However, conditional assignment of a nested constant raises a SyntaxError:
$ ruby -v -e 'module A; end; p A::X ||= 1'
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin10.8.0]
-e:1: constant re-assignment
But I can assign the constant unconditionally, of course:
$ ruby -v -e 'module A; end; p A::X = 1'
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin10.8.0]
1
Is this a bug?
Thanks,
Brian
Updated by steakknife (Barry Allard) over 14 years ago
Updated by ko1 (Koichi Sasada) over 14 years ago
- Assignee set to matz (Yukihiro Matsumoto)
Updated by shyouhei (Shyouhei Urabe) over 14 years ago
- Status changed from Open to Assigned
Updated by nahi (Hiroshi Nakamura) almost 14 years ago
Updated by nahi (Hiroshi Nakamura) almost 14 years ago
- Status changed from Assigned to Closed
Actions