【发布时间】:2014-11-20 17:19:57
【问题描述】:
我想知道,为什么H 在https://github.com/antirez/lamernews/blob/master/app.rb 的全局范围内?你可以看到它在第 53 行定义,在第 77 行使用,在 https://github.com/antirez/lamernews/blob/master/page.rb 的第 127 行输出。
任何明智的建议将不胜感激!
【问题讨论】:
我想知道,为什么H 在https://github.com/antirez/lamernews/blob/master/app.rb 的全局范围内?你可以看到它在第 53 行定义,在第 77 行使用,在 https://github.com/antirez/lamernews/blob/master/page.rb 的第 127 行输出。
任何明智的建议将不胜感激!
【问题讨论】:
因为以大写字母开头的常量可以在定义它们的类或模块中的任何位置访问,在外部使用前导 ::。
【讨论】: