logo       

[ruby-dev:29850] Re: Module duplicate: msg#00123

Subject: [ruby-dev:29850] Re: Module duplicate
まつもと ゆきひろです

In message "Re: [ruby-dev:29849] Re: Module duplicate"
    on Mon, 6 Nov 2006 10:14:12 +0900, Shugo Maeda <shugo@xxxxxxxxxxxxx> writes:

|Mが2回現れるのは気持ち悪いと思うのですが、

それは主観なんでちょっと置いといて。
# 前田くん向けの説明:
# (コピーしないけど)Satherのinlcudeであると思えば気持ち悪く
# ないかも。

|>  導入の理由は、include したことをしっかりと影響を与えるため(上記例では
|> C2 で M を include したら、C2 のメソッド m より先に M のメソッド m が呼
|> ばれて欲しい、とか)ということです。
|
|ということだと、他の選択肢は
|
|[C2, M, C1, Object, Kernel, BasicObject]
|
|になるのでしょうか。

これはありえないと思います。C1がMに依存してたら動かなくなり
ますから。

|なので、1.8の挙動の方が好ましいような気がするのですが、この変更が原因
|で動かなくなっているコードがないのなら、問題ないのかなあ。

その場合、C2はMを直接includeしたのに、見えるのはC1で「修飾」
されたメソッドになりますよね。overrideとかaliasとかundefとか。
それは嬉しくないんじゃないかなあ。で、このケースだとそうでも
ないんですが、

  module M1
  end
  module M2
    include M1
  end
  module M3
    include M1
  end
  class C1
    include M2
  end
  class C2<C1
    include M3
  end

のようなケースだと、特にM3とM1の間にいろいろ入ることの嬉しく
なさが目立ちそうです。

で、動かなくなるコードがあるかどうかですが、test/unitの一部
が動かなくなったので、手を入れました。それ以外には大きな問題
は無かったようです。

                                まつもと ゆきひろ /:|)




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
linux.arklinux....    user-groups.lin...    kde.usability/2...    ietf.ipp/2002-0...    mail.spam.spamc...    os.netbsd.devel...    audio.cd-record...    text.unicode.de...    php.documentati...    games.fps.halfl...    window-managers...    suse.oracle.gen...    bug-tracking.gn...    video.dvdrip.us...    xfree86.cvs/200...    java.netbeans.m...    network.argus/2...    culture.sf.kill...    debian.ports.al...    freebsd.questio...    qplus.devel/200...    handhelds.palm....   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe