[#37762] tcltklibの作りかた — Mitsuo Igarashi <mitsu5@...>
mitsu5 です。
8 messages
2003/06/07
[#37774] Ruby/zlibのインストール方法はどのようにするのですか? — "igusa" <igusa@...>
いぐさです。
6 messages
2003/06/09
[#37801] 動的に生成したクラスメソッドのundef — Ryuichiro Hara <r@...>
動的に生成したメソッドを除く方法を知りたく質問します。
6 messages
2003/06/19
[#37814] Re: Oniguruma and PHP — kkosako@...
> スラッシュドットでも話題になっていましたが、Onigurumaを
1 message
2003/06/23
[#37815] 配列の使い方 — Kouji Miyauchi <koji.miyauchi@...>
宮内と申します。
9 messages
2003/06/23
[#37830] reference from nested class to a constant in a module included by the parent class — NISHIMATSU Takeshi <t-nissie@...>
西松と申します.
6 messages
2003/06/27
[#37838] Raccのインストールについて (MacOS X) — "Ken'ichiro Nakatani" <kenzo@...>
はじめまして。中谷と申します。
8 messages
2003/06/27
[ruby-list:37830] reference from nested class to a constant in a module included by the parent class
From:
NISHIMATSU Takeshi <t-nissie@...>
Date:
2003-06-27 13:11:33 UTC
List:
ruby-list #37830
西松と申します.
ネストしたクラスから親クラスでincludeしたModule内の定数を参照
する場合, 下の例のように モジュール名:: をつけなければNameError
になるようです. 直感的には モジュール名:: を省略できてもよいと
思うのですがどうでしょう. それともなにか理由があるのでしょうか.
# incmod.rb
module M
ConstM = "M"
end
class Parent
ConstP = "P"
include M
p ConstP # => "P"
p M::ConstM # => "M"
p ConstM # => "M"
class Nested
p ConstP # => "P"
p M::ConstM # => "M"
p ConstM # => uninitialized constant Parent::Nested::ConstM (NameError)
end
end
p Parent::ConstP # => "P"
p Parent::M::ConstM # => "M"
p Parent::ConstM # => "M"
p M::ConstM # => "M"
ぼくはRubyのincludeを「梱包を解いてそこに置く」というかんじで
理解しています.
--
love && peace && free_software
西松 毅