【ruby语言】c constT = proc {' in there'} 这条语句什么意思啊,::这个运算符到底有什么作用啊

[ruby-core:39282] [Ruby 1.9 - Bug #3422] Object.const_get(:A, false) can access BasicObject::A
Issue #3422 has been updated by Yui NARUSE.
ruby -v changed from - to ruby 1.9.2dev ( revision 28117) [x86_64-darwin10.3.0]
nobu lazily closed this ticket without the revision reference: r33163.
----------------------------------------
Bug #3422: Object.const_get(:A, false) can access BasicObject::A
Author: Magnus Holm
Status: Closed
Priority: Normal
Assignee: Yukihiro Matsumoto
Category: core
Target version: 1.9.3
ruby -v: ruby 1.9.2dev ( revision 28117) [x86_64-darwin10.3.0]
From the documentation of Module#const_get(sym, inherit=true):
If the constant is not defined or is defined by the ancestors and inherit is false, NameError will be raised.
Yet, this works fine:
BasicObject::A = 1
Object.const_get(:A, false) # =& 1
While I haven't tested it, I believe the attached patch should fix the issue.

我要回帖

更多关于 const char 的文章

 

随机推荐