[#35688] サブクラスのオブジェクト生成時に、スーパークラスの初期化を行うには ? — Onodera Takafumi <onodera-tak@...>

9 messages 2002/08/01

[#35772] Unsecure world writeable dirの警告 — "井上 浩一" <kyoui32@...>

=1B$B0f>e$G$9!#=1B(B

31 messages 2002/08/26
[#35774] Re: Unsecure world writeable dir の警告 — matz@... (Yukihiro Matsumoto) 2002/08/26

まつもと ゆきひろです

[#35775] Re: Unsecure world writeabledir の警告 — nobu.nakada@... 2002/08/26

なかだです。

[#35776] Re: Unsecure world writeabledir の警告 — matz@... (Yukihiro Matsumoto) 2002/08/26

まつもと ゆきひろです

[#35778] Re: Unsecure world writeabledir の警告 — nobu.nakada@... 2002/08/26

なかだです。

[#35779] Re: Unsecure world writeabledir の警告 — WATANABE Hirofumi <eban@...> 2002/08/26

わたなべです。

[#35780] Re: Unsecure world writeabledir の警告 — nobu.nakada@... 2002/08/26

なかだです。

[#35784] Re: Unsecure world writeabledir の警告 — "U.Nakamura" <usa@...> 2002/08/26

こんにちは、なかむら(う)です。

[#35854] Re: Unsecure world writeabledir の警告 — "Inoue" <rubyist@...1.117.ne.jp> 2002/09/04

井上です。

[#35865] Re: Unsecure world writeabledir の警告 — Koji Arai <JCA02266@...> 2002/09/05

新井です。

[#35866] Re: Unsecure world writeabledir の警告 — matz@... (Yukihiro Matsumoto) 2002/09/06

まつもと ゆきひろです

[#35789] multipart な CGI を速くしたい — Takashi Kanai <kanai@...4u.or.jp>

Windows上でRubyとMySQLを使ってショッピングサイトのようなものを作って

17 messages 2002/08/28

[ruby-list:35710] Re: scope-in-state [Re: new mathn [Re: Rational#to_int ~ String#center]]

From: Shin-ichiro HARA <sinara@...>
Date: 2002-08-05 10:02:04 UTC
List: ruby-list #35710
原です。

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

>module M0
>    def foo; 0; end
>end
>
>class Foo
>    include M0
>end
>
>module S
>   module M0
>     def foo; 1; end
>   end
>end
>
>ScopeS = ScopeInState.new(S)
>
>class Foo             # <- ここがみそ
>    include M0
>end
>
>foo = Foo.new
>p foo.foo #=> 0
>ScopeS.scope_in do
>    p foo.foo #=> 1
>end
>p foo.foo #=> 0
>
>ただ... 『ここがみそ』のところを実行しないとだめなんですが...
>ScopeInState.newでM0の継承列が変更されるのですが, rubyではそれがFooに
>伝達されませんので...

なる程。私は自前で継承列を構築する scope-in-state の強引さ:-)に
感動しました。こんなことができるんだなあと。

で、ちょっと刺激を受けて、エイリアスしまくるのを躊躇しないとした
らどうか、と思って作ったのが import-module です。import-module 
は、include するモジュールの入れ替えが(見た目)できます。例えば

module M0
   def foo; 0; end
end

class Foo
   include M0
end

module M1
   def foo; 1; end
end

o = Foo.new
p o.foo #=> 0
Foo.import_module(M1) do
   p o.foo #=> 1
end
p o.foo #=> 0

です。そもそも import-module では、同一モジュールの重ね include
(に見えること)ができます。

module M0
   def foo; 0; end
end

module M1
   def foo; 1; end
end

class Foo
   include M0
   include M1
end

o = Foo.new
p o.foo #=> 1
Foo.import_module(M0) do
   p o.foo #=> 0
end



In This Thread