[#1381] bound method — shugo@... (Shugo Maeda)

前田です。

21 messages 1998/02/04
[#1383] Re: bound method — matz@... (Yukihiro Matsumoto) 1998/02/05

まつもと ゆきひろです

[#1384] Re: bound method — keiju@... (石塚圭樹 ) 1998/02/05

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

[#1385] Re: bound method — matz@... (Yukihiro Matsumoto) 1998/02/05

まつもと ゆきひろです

[#1387] Re: bound method — keiju@... (石塚圭樹 ) 1998/02/05

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

[#1388] Re: bound method — matz@... (Yukihiro Matsumoto) 1998/02/05

まつもと ゆきひろです

[#1389] Re: bound method — keiju@... (石塚圭樹 ) 1998/02/05

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

[#1396] Re: bound method — matz@... (Yukihiro Matsumoto) 1998/02/06

まつもと ゆきひろです

[#1410] GD — Masao Kanemitsu <masao-k@...>

30 messages 1998/02/10
[#1411] Re: GD — matz@... (Yukihiro Matsumoto) 1998/02/10

まつもと ゆきひろです

[#1413] Re: GD — WATANABE Hirofumi <watanabe@...> 1998/02/10

わたなべです.

[#1417] Re: GD — Masao Kanemitsu <masao-k@...> 1998/02/10

<199802100623.PAA03533@eban.ase.ptg.sony.co.jp> の、

[#1420] Re: GD — WATANABE Hirofumi <watanabe@...> 1998/02/10

わたなべです.

[#1426] Re: GD — Masao Kanemitsu <masao-k@...> 1998/02/10

<199802100733.QAA04028@eban.ase.ptg.sony.co.jp> の、

[#1428] Re: GD — WATANABE Hirofumi <watanabe@...> 1998/02/10

わたなべです.

[#1429] Re: GD — Masao Kanemitsu <masao-k@...> 1998/02/10

<199802100757.QAA04212@eban.ase.ptg.sony.co.jp> の、

[#1431] Re: GD — WATANABE Hirofumi <watanabe@...> 1998/02/10

わたなべです.

[#1434] Re: GD — Masao Kanemitsu <masao-k@...> 1998/02/12

<199802100952.SAA04346@eban.ase.ptg.sony.co.jp> の、

[#1435] Re: GD — WATANABE Hirofumi <watanabe@...> 1998/02/12

わたなべです.

[#1436] Re: GD — Masao Kanemitsu <masao-k@...> 1998/02/12

<199802120449.NAA00398@eban.ase.ptg.sony.co.jp> の、

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

From: keiju@... (石塚圭樹 )
Date: 1998-02-04 04:40:43 UTC
List: ruby-dev #1378
けいじゅ@日本ラショナルソフトウェアです.

In [ruby-dev :01370 ] the message: "[ruby-dev:1370] Re: [MethodIndex]
Bug and question ", on Feb/03 13:42(JST) 石塚圭樹 writes:

とりあえず, [ruby-dev: 01370] のclass_ancestorsを用いて実装し始めまし
たが, バグと問題点がありました.

1. SEGV

[ruby-dev: 01370] のclass_ancestorsはmoduleでも適用できますので, 以下
のように定義し直しました.

class Module
  def module_ancestors
    # all = [[class1, mod1-ancestors, mod2-anectors], ... ]
    m_sets = {}
    a_serials = Class.ancestors.reverse.collect{|a| 
      if a.instance_of?(Module)
	m_sets[a] = a
      end
      [a]
    }
    for cls in ancestors.find_all{|m| ! m.instance_of?(Module)}.reverse
      ancs = [cls]
      for e in eval("class << cls; included_modules; end")
	for a in e.ancestors
	  if !m_sets.include?(a)
	    ancs.push a
	    m_sets[a] = cls
	  end
	end
      end
      a_serials.push ancs
    end
    a_serials.reverse!
  end
end

すると,

module Foo; end
Foo.module_ancestors

でSEGVします(;_;

2. Object#singleton_methods

rbc0> class Foo;end
rbc0> def Foo.fo;end
rbc0> Foo.singleton_methods
["fo"]
rbc0> class Bar < Foo; end
rbc0> Bar.singleton_methods
["fo"]

となります. 一見正しいように感じるのですが, 

rbc0> Class.instance_methods(TRUE)
["new", "superclass", "const_get", "undef_method", "===", "public_class_method", "ancestors", "constants", ">=", "remove_method", "<=", "method_defined?", "const_defined?", "name", "<", "private_instance_methods", "module_eval", "clone", ">", "const_set", "included_modules", "alias_method", "instance_methods", "to_s", "private_class_method", "<=>", "private_methods", "is_a?", "=~", "methods", "instance_eval", "instance_of?", "hash", "instance_variables", "respond_to?", "dup", "singleton_methods", "type", "equal?", "kind_of?", "extend", "inspect", "id", "send", "==", "nil?", "remove_instance_variable", "to_a", "eql?"]

が追加されているべきではないでしょうか??

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

In This Thread