[#62904] [ruby-trunk - Feature #9894] [Open] [RFC] README.EXT: document rb_gc_register_mark_object — normalperson@...
Issue #9894 has been reported by Eric Wong.
3 messages
2014/06/02
[#63321] [ANN] ElixirConf 2014 - Don't Miss Jos辿 Valim and Dave Thomas — Jim Freeze <jimfreeze@...>
Just a few more weeks until ElixirConf 2014!
6 messages
2014/06/24
[#63391] Access Modifiers (Internal Interfaces) — Daniel da Silva Ferreira <danieldasilvaferreira@...>
Hi,
3 messages
2014/06/28
[ruby-core:63152] [CommonRuby - Feature #9941] [Open] Issue a warning when `module` or `class` keyword causes re-initialization of a constant that will become the module/class name, instead of creating/reopening the module/class
From:
alexey.muranov@...
Date:
2014-06-13 15:27:35 UTC
List:
ruby-core #63152
Issue #9941 has been reported by Alexey Muranov.
----------------------------------------
Feature #9941: Issue a warning when `module` or `class` keyword causes re-initialization of a constant that will become the module/class name, instead of creating/reopening the module/class
https://bugs.ruby-lang.org/issues/9941
* Author: Alexey Muranov
* Status: Open
* Priority: Normal
* Assignee:
* Category:
* Target version:
----------------------------------------
I think that it would be appropriate to issue a warning similar to "warning: already initialized constant" when "`module`" or "`class`" keyword causes re-initialization of a constant. Here is an example of code that looks suspicious to me and IMO should issue such a warning:
```ruby
module A
module B
C = 1
end
end
module D
include A
end
puts D.constants # => B
puts D::B # => A::B
puts D::B::C # => 1
module D::B
end
puts D.constants # => B
puts D::B # => D::B
puts D::B::C # => uninitialized constant D::B::C (NameError)
```
P.S. I think this behavior is related to the impossibility to re-open anonymous classes/modules and to the somewhat strange IMO scoping rules for constants :).
--
https://bugs.ruby-lang.org/