[#1320] [MethodIndex] Bug and question — keiju@... (Keiju ISHITSUKA)

けいじゅ@日本ラショナルソフトウェアです.

32 messages 1998/01/23
[#1321] Re: [MethodIndex] Bug and question — matz@... (Yukihiro Matsumoto) 1998/01/23

まつもと ゆきひろです

[#1323] Re: [MethodIndex] Bug and question — keiju@... (Keiju ISHITSUKA) 1998/01/23

けいじゅ@日本ラショナルソフトウェアです.

[#1332] Re: [MethodIndex] Bug and question — keiju@... (Keiju ISHITSUKA) 1998/01/27

けいじゅ@日本ラショナルソフトウェアです.

[#1333] Re: [MethodIndex] Bug and question — matz@... (Yukihiro Matsumoto) 1998/01/27

まつもと ゆきひろです

[#1334] Re: [MethodIndex] Bug and question — keiju@... (石塚圭樹 ) 1998/01/27

けいじゅ@日本ラショナルソフトウェアです.

[#1351] Re: [MethodIndex] Bug and question — keiju@... (石塚圭樹 ) 1998/01/29

けいじゅ@日本ラショナルソフトウェアです.

[#1353] Re: [MethodIndex] Bug and question — matz@... (Yukihiro Matsumoto) 1998/01/29

まつもと ゆきひろです

[#1354] Re: [MethodIndex] Bug and question — keiju@... (石塚圭樹 ) 1998/01/29

けいじゅ@日本ラショナルソフトウェアです.

[#1355] Re: [MethodIndex] Bug and question — matz@... (Yukihiro Matsumoto) 1998/01/30

まつもと ゆきひろです

[ruby-dev:1351] Re: [MethodIndex] Bug and question

From: keiju@... (石塚圭樹 )
Date: 1998-01-29 07:56:47 UTC
List: ruby-dev #1351
けいじゅ@日本ラショナルソフトウェアです.

In the message: "[ruby-dev:1333] Re: [MethodIndex] Bug and question ",
on Jan/27 15:58(JST) 石塚圭樹 writes:

さらに質問したいことができてしまいました.

>>|4. 質問
>>|4.1 旧MethodIndexのメソッドの表示について.

4.2 クラス(モジュール)メソッドについて

クラスの継承関係とクラスメソッドの継承って実は違っていますよね? モジュー
ルのメソッドは継承しないし, クラスに対してextendできるし...

そこで, ancestorsに関する質問ですが...

rbc0> class Foo
rbc1> end
nil
rbc0> class Bar < Foo
rbc1> end
nil
#1
rbc0> Bar.ancestors
[Bar, Foo, Object, Kernel]
#2
rbc0> Bar.type.ancestors
[Class, Class, Class, Module, Object, Kernel]
#3
rbc0> class << Bar
rbc1> ancestors
rbc1> end
[Class, Class, Class, Class, Module, Object, Kernel]

#1, #2が違うのは良いんですが, なぜ #2, #3は異なっているのでしょう?

それに, 最初の3,4個のClassは実際には何なんでしょうね? 気分的には:

  Barの特異クラス < Fooの特異クラス < Objectの特異クラス <
    Class < Module < Object < Kernel

となるべきかなと思うんですが?

# そうすると, Bar.type.ancestorsは1つクラスが少ない?  でも, 良く考えた
# らBar.typeが変なのかな? Classそのものを返すべきじゃないかと思うんで
# すが? 今は特異クラス返していますよね?

4.3 つぎに, incetance_of?に関する質問ですが.

rbc0> Bar.instance_of?(Bar.type.ancestors[0])
false
rbc0> Bar.instance_of?(Bar.type.ancestors[1])
false
rbc0> Bar.instance_of?(Bar.type.ancestors[2])
true
rbc0> Bar.instance_of?(Bar.type.ancestors[3])
false
rbc0> Bar.instance_of?(Bar.type.ancestors[4])
false

というけっががでます. なんとなく直観と合わないんですが?


__
................................石塚 圭樹@日本ラショナルソフトェア...
----------------------------------->> e-mail: keiju@rational.com <<---

In This Thread