From: Kazuo Saito Date: 2003-10-13T16:48:17+09:00 Subject: [ruby-list:38527] ruby-dev summary 21531-21607 (draft) 斉藤です。 今週分の ruby-dev summary です。 一応、ruby-list の方むけに、サマライズのルールを挙げておきます。 (1)bug修正のみのスレッドは基本的に外す。 大きな仕様変更などで流しておきたい、意見が欲しい、などの リクエストがあれば入れる。 (2)結論が確定してなければ次回に回しても可(私だけ?:-)。 今回 autoload の問い合わせは抜きました。 (3)土曜か日曜に draft を出す。月曜か火曜くらいには ruby-talkへ。ruby-devの全記事網羅よりは週刊を厳守。 (4)流せる記事が少なければ、次週に持ち越し。 です。というわけで、一日遅れててすみませんが、添削お願いします。 今回は休日出勤中にコソコソ書いてる(笑)ので間違いの指摘が 多いかもしれません。水曜には出したい、です。 =begin [ruby-dev:21531] O_ACCMODE Tanaka Akira added a constant Fcntl::O_ACCMODE defined in POSIX fcntl.h to ext/fcntl module. [ruby-dev:21538] rb_frame_last_func for alias method In the method added alias, rb_frame_last_func() returns the ID for the alias name in 1.8.0 release. In 1.6.0, this returns the ID for the original name. Kazuhiro Yoshida asked how to get original name ID and Matz recommended to include "env.h" and get the ID from ruby_frame->orig_func. [ruby-dev:21543] Enumerator From request for adding Enumerator to latest CVS tree by Akinori MUSHA, Koji Arai and him discuss when and how to add new libraries into Ruby main tree. The libraries are in rough/ directory separately. At this time they have the same opinion that it will be a good help for both library developers and users to bundle it with main development(unstable) CVS tree early. Arai said that the library will have an opportunity for appeal, evaluation and refinement, but it should already has reasonable maturity for compilation and execution. MUSHA also mentioned the library developer should also provide backward compatibility, such as API compatibility and stand-alone distribution of the library for old Ruby versions. [ruby-dev:21590] extend with marshal_dump/marshal_load NAKAMURA, Hiroshi and Matz talked about keeping 'extend' information of marshaled object. It is ignored by default. When users define original marshal_dump and marshal_load, they are responsible for supporting the information by themselves. Matz showed us an example how to dump and load such objects correctly in [ruby-dev:21593]. In following example, objects of class Quux can be dumped and loaded. Notice that class Foo and Bar does not needed to concern about marshaling 'extend' info. This example is already applied some patches by NaHi in [ruby-dev:21595] to original one: ---- class Foo def initialize @data_a = 1 @r, @w = IO.pipe end def marshal_dump @data_a end def marshal_load(obj) @data_a = obj @r, @w = IO.pipe end end class Bar < Foo def initialize super @data_b = 2 end def marshal_dump [super, @data_b] end def marshal_load(data) super(data[0]) @data_b = data[1] end end module ExtendMarshal def marshal_dump base_data = super extends = (class << self; self; end).ancestors - self.class.ancestors - [ExtendMarshal] data = {:modules => extends, :base => base_data} extends.each do |m| m.instance_method(:marshal_dump_extend).bind(self).call(data) end data end def marshal_load(data) extends = data[:modules] extends.reverse_each do |m| self.extend(m) m.instance_method(:marshal_load_extend).bind(self).call(data) end super(data[:base]) end end module Baz include ExtendMarshal def marshal_dump_extend(data) data[:Baz] = 42 end def marshal_load_extend(data) @baz_data = data[:Baz] end end class Quux