[#3747] constants (or class vriable?) — Wakou Aoyama <wakou@...>
青山です。
原です。
青山です。
まつもと ゆきひろです
In message <199812080034.JAA05946@picachu.netlab.co.jp>
立石です。
まつもと ゆきひろです
[#3773] pack("M")/unpack("M") — shugo@... (MAEDA Shugo)
前田です。
[#3794] port NetBSD/ alpha 1.3I — SHIROYAMA Takayuki <psi@...>
[#3826] ruby 1.1d0 released — matz@... (Yukihiro Matsumoto)
まつもと ゆきひろです
渡辺哲也です。
ふなばです。
笠原です。
前田です。
[#3851] tkutil patch (for 1.1d0) — ttate@...
立石です。
[#3859] missing/setenv.c in 1.1d0 — Inaba Hiroto <inaba@...>
稲葉です。こんなにパッチがあると、みのがされてしまうかも。
[#3862] 1.1d0 new here document — Wakou Aoyama <wakou@...>
青山です。
まつもと ゆきひろです
青山です。
まつもと ゆきひろです
[#3873] (?: ) does not work? — shugo@... (MAEDA Shugo)
前田です。
まつもと ゆきひろです
前田です。
まつもと ゆきひろです
前田です。
白山@Stellarです。
[#3881] I want to catch all jump — shugo@... (Shugo Maeda)
前田です。
まつもと ゆきひろです
前田です。
まつもと ゆきひろです
[#3894] ruby 1.1d1 released — matz@... (Yukihiro Matsumoto)
まつもと ゆきひろです
わたなべです.
[#3899] interpreter reinitialization — shugo@... (Shugo Maeda)
前田です。
まつもと ゆきひろです
前田です。
まつもと ゆきひろです
前田です。
まつもと ゆきひろです
前田です。
まつもと ゆきひろです
[#3962] ruby 1.3(!) released — matz@... (Yukihiro Matsumoto)
まつもと ゆきひろです
[#3966] [BUG] exception in safe level 4 — shugo@... (Shugo Maeda)
前田です。
[#3997] [BUG] "#{}" while 1 — gotoken@... (GOTO Kentaro)
ごとけんです
まつもと ゆきひろです
[#4002] config.guess — Koji Arai <JCA02266@...>
新井です。
まつもと ゆきひろです
新井です。
まつもと ゆきひろです
新井です。
まつもと ゆきひろです
笠原です。
まつもと ゆきひろです
えぐち@エスアンドイー です。
[#4005] [BUG] ruby 1.3(98/12/24) [i686-linux] at rb_gc_mark() — Ryo HAYASAKA <hayasaka@...>
早坂@会津大学といいます。
In message "[ruby-dev:4005] [BUG] ruby 1.3(98/12/24) [i686-linux] at rb_gc_mark()"
早坂@会津大学です。
[#4015] Integer proper methods — gotoken@... (GOTO Kentaro)
ごとけんです
[#4030] module Precision — gotoken@... (GOTO Kentaro)
ごとけんです
ごとけんです
まつもと ゆきひろです
ごとけんです
けいじゅ@日本ラショナルソフトウェアです.
ごとけんです
まつもと ゆきひろです
まつもと ゆきひろです
ごとけんです
まつもと ゆきひろです
ごとけんです
ごとけんです
けいじゅ@日本ラショナルソフトウェアです.
ごとけんです
まつもと ゆきひろです
まつもと ゆきひろです
まつもと ゆきひろです
ごとけんです
ごとけんです
けいじゅ@日本ラショナルソフトウェアです.
ごとけんです
けいじゅ@日本ラショナルソフトウェアです.
ごとけんです
けいじゅ@日本ラショナルソフトウェアです.
ごとけんです
けいじゅ@日本ラショナルソフトウェアです.
最近あんまり建設的でないわたし.
けいじゅ@日本ラショナルソフトウェアです.
ごとけんです
原です。
[#4032] [Req] make-symbol? — shugo@... (Shugo Maeda)
前田です。
[ruby-dev:3721] Re: new delegator
まつもと ゆきひろです
In message "[ruby-dev:3720] Re: new delegator"
on 98/12/01, 石塚圭樹 <keiju@rational.com> writes:
|けいじゅ@日本ラショナルソフトウェアです.
|> rescue Exception
|> n = if /:in `__getobj__'$/ =~ $@[0] then 1 else 2 end #`
|> $@[1,n] = nil
|> raise
|> end
|>end
|
|この辺りが問題ありのままです.
あ,忘れてた.でも,本体にパッチ当てる必要がありました.
--- eval.c 1998/11/17 09:12:30 1.1.1.2.2.82
+++ eval.c 1998/12/01 07:17:49
@@ -387,3 +387,6 @@
-#define POP_FRAME() the_frame = _frame.prev; }
+#define POP_FRAME() \
+ sourcefile = _frame.file; \
+ sourceline = _frame.line; \
+ the_frame = _frame.prev; }
でもって変更したdelegate.rbです
--
# Delegation class that delegates even methods defined in super class,
# which can not be covered with normal method_missing hack.
#
# Delegator is the abstract delegation class. Need to redefine
# `__getobj__' method in the subclass. SimpleDelegator is the
# concrete subclass for simple delegation.
#
# Usage:
# foo = Object.new
# foo2 = SimpleDelegator.new(foo)
# foo.hash == foo2.hash # => true
#
# Foo = DelegateClass(Array)
#
# class ExtArray<DelegateClass(Array)
# ...
# end
class Delegator
def initialize(obj)
preserved = ::Kernel.instance_methods
preserved -= ["to_s","to_a","inspect","==","=~","==="]
for t in self.type.ancestors
preserved |= t.instance_methods
preserved |= t.private_instance_methods
preserved |= t.protected_instance_methods
break if t == Delegator
end
for method in obj.methods
next if preserved.include? method
eval <<EOS
def self.#{method}(*args, &block)
begin
__getobj__.__send__(:#{method}, *args, &block)
rescue Exception
c = -caller(0).size
if /:in `__getobj__'$/ =~ $@[c-1] #`
n = 1
else
c -= 2
n = 3
end
$@[c,n] = nil
raise
end
end
EOS
end
end
def __getobj__
raise NotImplementError, "need to define `__getobj__'"
end
end
class SimpleDelegator<Delegator
def initialize(obj)
super
@obj = obj
end
def __getobj__
@obj
end
def __setobj__(obj)
@obj = obj
end
end
# backward compatibility ^_^;;;
Delegater = Delegator
SimpleDelegater = SimpleDelegator
#
def DelegateClass(superclass)
klass = Class.new
methods = superclass.instance_methods
methods -= ::Kernel.instance_methods
methods |= ["to_s","to_a","inspect","==","=~","==="]
klass.module_eval <<EOS
def initialize(obj)
@obj = obj
end
EOS
for method in methods
klass.module_eval <<EOS
def #{method}(*args, &block)
begin
@obj.__send__(:#{method}, *args, &block)
rescue
$@[0,2] = nil
raise
end
end
EOS
end
return klass;
end
if __FILE__ == $0
class ExtArray<DelegateClass(Array)
def initialize()
super([])
end
end
ary = ExtArray.new
p ary.type
ary.push 25
p ary
foo = Object.new
def foo.test
raise 'this is OK'
end
foo2 = SimpleDelegator.new(foo)
p foo.hash == foo2.hash # => true
foo.test # raise error!
end