[#9445] thread.rb — m_seki@...

18 messages 2000/03/16
[#9446] Re: thread.rb — matz@... (Yukihiro Matsumoto) 2000/03/17

[#9460] Re: thread.rb — m_seki@... 2000/03/21

[#9462] Re: thread.rb — matz@... (Yukihiro Matsumoto) 2000/03/21

まつもと ゆきひろです

[#11281] Re: thread.rb — Masatoshi SEKI <m_seki@...> 2000/10/22

[#9498] timeout しない timeout — ARIMA Yasuhiro <fit0298@...>

有馬です。

20 messages 2000/03/26
[#9506] Re: timeout しない timeout — matz@... (Yukihiro Matsumoto) 2000/03/27

まつもと ゆきひろです

[#9509] Re: timeout しない timeout — gotoken@... (GOTO Kentaro) 2000/03/27

In message "[ruby-dev:9506] Re: timeout しない timeout"

[ruby-dev:9383] rb_call_super()

From: Yasushi Shoji <yashi@...>
Date: 2000-03-06 13:00:59 UTC
List: ruby-dev #9383
やすしです。

まつもとさん、rb_call_super()ありがとうございます。

でも、使いきれません(^^;;

1.4.3に rb_call_super()を切り貼りして試しているのですが‥。

$ ruby test.rb 
This is Derived
test.rb:4:in `hoge': superclass method `hoge' disabled (NameError)
        from test.rb:4

と、でます。

eval.cで

>    if (ruby_frame->last_class == 0) {	
>	rb_raise(rb_eNameError, "superclass method `%s' disabled",
>		 rb_id2name(ruby_frame->last_func));

と、なっているので、ruby_frame->last_classが 0なんでしょうけど、ruby
internalをまるでわかってないので‥‥‥。

つかってる test file達を付けるので、どこか間違っているとこがあれば指摘し
てもらえれば幸いです。
--
          yashi


#include "ruby.h"

VALUE myDerived;
VALUE myBase;

static VALUE
myBase_hoge(int argc, VALUE *argv, VALUE self)
{
	printf("This is Base\n");
	return self;
}

static VALUE
myDerived_hoge(int argc, VALUE *argv, VALUE self)
{
	printf("This is Derived\n");
	rb_call_super(argc, argv);
	return self;
}

Init_my()
{
	myBase = rb_define_class("Base", rb_cObject);
	myDerived = rb_define_class("Derived", myBase);

	rb_define_method(myBase, "hoge", myBase_hoge, -1);
	rb_define_method(myDerived, "hoge", myDerived_hoge, -1);
}



# extconf.rb
require 'mkmf'

create_makefile('my')



# test.rb
require 'my'

o = Derived.new
o.hoge

In This Thread

Prev Next