[#3193] Re: Matrix — keiju@...

けいじゅ@今はフリー(^^;;;です.

67 messages 1997/06/30
[#3194] Re: Matrix — shugo@... (maeda shugo) 1997/06/30

前田です。

[#3195] Re: Matrix — matz@... (Yukihiro Matsumoto) 1997/06/30

まつもと ゆきひろです

[#3220] Re: Matrix — keiju@... (石塚圭樹 ) 1997/07/01

けいじゅ@今はフリー(^^;;;です.

[#3222] Re: Matrix — matz@... (Yukihiro Matsumoto) 1997/07/01

まつもと ゆきひろです

[#3224] Re: Matrix — keiju@... (石塚圭樹 ) 1997/07/01

けいじゅ@今はフリー(^^;;;です.

[#3229] Re: Matrix — matz@... (Yukihiro Matsumoto) 1997/07/02

まつもと ゆきひろです

[#3254] Ver 1.1 [Re: Matrix] — keiju@... (石塚圭樹 ) 1997/07/02

けいじゅ@まだまだフリー(;_;です.

[#3256] Re: Ver 1.1 [Re: Matrix] — matz@... (Yukihiro Matsumoto) 1997/07/02

まつもと ゆきひろです

[#3280] Re: Ver 1.1 [Re: Matrix] — keiju@... (石塚圭樹 ) 1997/07/04

けいじゅ@今はフリー(^^;;;です.

[#3282] exceptions (Re: Ver 1.1 [Re: Matrix]) — matz@... (Yukihiro Matsumoto) 1997/07/04

まつもと ゆきひろです

[#3292] meta programings [Re:exceptions (Re: Ver 1.1 [Re: Matrix])] — keiju@... (石塚圭樹 ) 1997/07/07

けいじゅ@今はフリー(^^;;;です.

[#3293] Re: meta programings [Re:exceptions (Re: Ver 1.1 [Re: Matrix])] — matz@... (Yukihiro Matsumoto) 1997/07/07

まつもと ゆきひろです

[#3294] Re: meta programings [Re:exceptions (Re: Ver 1.1 [Re: Matrix])] — keiju@... (石塚圭樹 ) 1997/07/07

けいじゅ@今はフリー(^^;;;です.

[#3295] Re: meta programings [Re:exceptions (Re: Ver 1.1 [Re: Matrix])] — matz@... (Yukihiro Matsumoto) 1997/07/07

まつもと ゆきひろです

[#3296] Re: meta programings [Re:exceptions (Re: Ver 1.1 [Re: Matrix])] — keiju@... (石塚圭樹 ) 1997/07/07

けいじゅ@今はフリー(^^;;;です.

[#3297] Re: meta programings [Re:exceptions (Re: Ver 1.1 [Re: Matrix])] — matz@... (Yukihiro Matsumoto) 1997/07/07

まつもと ゆきひろです

[#3302] Re: meta programings [Re:exceptions (Re: Ver 1.1 [Re: Matrix])] — keiju@... (石塚圭樹 ) 1997/07/08

けいじゅ@今はフリー(^^;;;です.

[#3304] Re: meta programings [Re:exceptions (Re: Ver 1.1 [Re: Matrix])] — matz@... (Yukihiro Matsumoto) 1997/07/08

まつもと ゆきひろです

[#3309] Re: meta programings [Re:exceptions (Re: Ver 1.1 [Re: Matrix])] — keiju@... (石塚圭樹 ) 1997/07/09

けいじゅ@今はフリー(^^;;;です.

[#3313] Re: meta programings [Re:exceptions (Re: Ver 1.1 [Re: Matrix])] — matz@... (Yukihiro Matsumoto) 1997/07/10

まつもと ゆきひろです

[#3320] Re: meta programings [Re:exceptions (Re: Ver 1.1 [Re: Matrix])] — matz@... (Yukihiro Matsumoto) 1997/07/10

まつもと ゆきひろです

[#3331] Re: meta programings [Re:exceptions (Re: Ver 1.1 [Re: Matrix])] — keiju@... (Keiju ISHITSUKA) 1997/07/11

けいじゅ@今はフリー(^^;;;です.

[#3342] Re: meta programings [Re:exceptions (Re: Ver 1.1 [Re: Matrix])] — matz@... (Yukihiro Matsumoto) 1997/07/14

まつもと ゆきひろです

[#3228] Re: 引っ越し(Re: Re: Matrix) — shugo@... (maeda shugo) 1997/07/02

前田です。

[#3231] Re: 引っ越し(Re: Re: Matrix) — matz@... (Yukihiro Matsumoto) 1997/07/02

まつもと ゆきひろです

[#3200] 広報活動 — matz@... (Yukihiro Matsumoto)

まつもと ゆきひろです

18 messages 1997/06/30

[ruby-list:3114] Re: [Q] singleton method for module

From: keiju@... (Keiju ISHITSUKA)
Date: 1997-06-13 05:23:14 UTC
List: ruby-list #3114
けいじゅ@今はフリー(^^;;;です. 

In the message: "[Q] singleton method for module ", on Jun/12 16:21(JST) 
Keiju ISHITSUKA writes:

>クラスの特異メソッドはサブクラスに対して継承されますが, モジュールの特
>異メソッドはインクルードしたクラスに継承されませんね?
>
>これは, 何か深い理由があるのでしょうか?

実際にやりたいことに関しては, includeしないで, extendすれば良いことに
気づきました.

それで, 実際にやりたかったのは以下のようなことです. 

module Foo
  def foo(txt)
    eval("class C1
	  end
	  print C1", txt)
  end
  private :foo
end

class Bar
  extend Foo
  
  foo(binding)
end

class Baz
  extend Foo

  foo(binding)
end

こんな感じであるモジュールで定義された関数を用いて, 元のクラスでローカ
ルなクラスを定義したかったわけです. ここで質問なんですが, これでは, 引
数としてbindingを常に渡さなくてはなりません. ちょっと, 冗長な気がする
ので何か他の方法で, サブクラスローカルなクラスをうまく定義する方法って
ないですかねえ?

最悪, モジュールでもreceiverはselfで参照できますので,

def def_class(first, second = nil, *rest)
  "class #{first}\n" +
    (if second
       def_class(second, *rest)
     else
       "class C1\nend\n"
     end) +
     "end\n"
end

def foo
  def_class(*self.split("::"))
end

という方法もありますが... ちょっとエレガントじゃないような..

__
.........................................石塚 圭樹@今はフリー(^^;;...
------->>また, アドレス変わりました!! e-mail: keiju@bc.mbn.or.jp <<---

In This Thread

Prev Next