< :前の番号
^ :番号順リスト
> :次の番号
P :前の記事(スレッド移動)
N :次の記事(スレッド移動)
|<:前のスレッド
>|:次のスレッド
^ :返事先
_:自分への返事
>:同じ返事先を持つ記事(前)
<:同じ返事先を持つ記事(後)
---:分割してスレッド表示、再表示
| :分割して(縦)スレッド表示、再表示
~ :スレッドのフレーム消去
.:インデックス
..:インデックスのインデックス
Issue #14895 has been updated by jeremyevans0 (Jeremy Evans).
marcandre (Marc-Andre Lafortune) wrote in #note-7:
> So I suggest I'll commit your patch, unless there's an objection.
I have no objection, so if you consider the current behavior a bug, please commit the patch (assuming it doesn't cause test or spec failures).
----------------------------------------
Bug #14895: Inconsistent constant names when using const_set on a singleton class
https://bugs.ruby-lang.org/issues/14895#change-87338
* Author: silver_phoenix (Pedro Pinto)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.6.0preview2 (2018-05-31 trunk 63539) [x86_64-linux]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
```
irb(main):001:0> class X; end
=> nil
irb(main):002:0> X.const_set(:Y, Module.new)
=> X::Y
irb(main):003:0> module M; end
=> nil
irb(main):004:0> M.const_set(:N, Module.new)
=> M::N
irb(main):005:0> x = Object.new
=> #<Object:0x000055886ee2b110>
irb(main):006:0> x.singleton_class.const_set(:Z, Module.new)
=> #<Module:0x000055886ec59a80>
irb(main):007:0> x.singleton_class.class_eval "module A; self end"
=> #<Class:0x000055886ec59d00>::A
irb(main):008:0> x.singleton_class.const_set(:B, Module.new)
=> #<Class:0x000055886ec59d00>::B
```
I would expect module `Z` to be named, but the modules only start being named after creating module `A` through the `module` builtin.
For consistency, if module `B` is named, shouldn't module `Z` be named as well?
Also happens in these ruby versions:
`ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]`
`ruby 2.5.1p57 (2018-03-29 revision 63029) [i386-mingw32]`
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>