Rinda/eval.rb


#1

e$B31$H$$$$$^$9!#e(B

Rindae$B$Ke(BLindae$B$Ne(Bevale$B$rDI2C$7$?$$$H;W$C$F$^$9!#e(B
(1.8e$B$He(B1.9e$B$=$l$>$l$Ke(B)

Lindae$B$Ne(Bevale$B$O?7$7$$%W%m%;%9$r@8@.$7$F<0$rI>2A$7!"$=$N7ke(B
e$B2L$r%?%W%ke(B
e$B%9%Z!<%9$XEjF~$9$k$b$N$G$9!#e(B
Rindae$B$G$O%V%m%C%/$re(Bforke$B$7$?%W%m%;%9$GI>2A$7$F$=$N7k2L$re(B
e$B%?%W%k$H$7$Fe(B
e$BEjF~$9$k%$%s%?!<%U%’%$%9$K$9$k$D$b$j$G$9!#e(B

e$B$=$3$G?7$7$$%i%$%V%i%j$rDI2C$9$k$K$"$?$C$F<ALd$,$"$j$^$9!#e(B

(1) forke$B$r$D$+$C$F$b$h$$$G$9$+e(B? e$B$?$V$se(BWindowse$B$GF0e(B
e$B:n$7$^$;$s!#e(B
(2) e$B%]!<%?%V%k$J%F%9%H$,$+$1$J$$5$$,$7$^$9$,!"$J$/$F$b$+$^$$e(B
e$B$^$;$s$+!)e(B
open3e$B$H$+$I$&$7$F$k$s$@$m!#e(B

e$B%3!<%I$8$?$$$O$?$V$s$3$s$J"-46$8$G$9!#e(B


require ‘drb/drb’
require ‘rinda/rinda’

module Rinda
class TupleSpace
def rinda_eval(&blk)
Rinda::rinda_eval(self, &blk)
end
end

class TupleSpaceProxy
def rinda_eval(&blk)
Rinda::rinda_eval(@ts, &blk)
end
end

module_function
def rinda_eval(ts)
ts = DRbObject.new(ts) unless DRbObject === ts
pid = fork do
DRb.stop_service
DRb.start_service(‘druby://127.0.0.1:0’)
place = TupleSpaceProxy.new(ts)
tuple = yield(place)
place.write(tuple)
end
Process.detach(pid)
end
end


#2

In article removed_email_address@domain.invalid,
Masatoshi SEKI removed_email_address@domain.invalid writes:

(1) forke$B$r$D$+$C$F$b$h$$$G$9$+e(B? e$B$?$V$se(BWindowse$B$GF0e(B
e$B:n$7$^$;$s!#e(B
(2) e$B%]!<%?%V%k$J%F%9%H$,$+$1$J$$5$$,$7$^$9$,!"$J$/$F$b$+$^$$e(B
e$B$^$;$s$+!)e(B
open3e$B$H$+$I$&$7$F$k$s$@$m!#e(B

Ruby 1.9 e$B$Ne(B open3 e$B$Oe(B fork e$B%a%=%C%I$r;H$C$F$$$^$;$s!#e(B

e$B$R$H$H$*$jF0$+$9%F%9%H$rF~$l$F$"$j$^$9$,!“LdBj$,$”$k$H$OJ9$$e(B
e$B$F$$$^$;$s!#e(B


#3

e$B31$H$$$$$^$9!#e(B

e$B$"$j$,$H$&$4$6$$$^$9!#e(B

On 2009/03/31, at 11:16, Tanaka A. wrote:

In article removed_email_address@domain.invalid,
Masatoshi SEKI removed_email_address@domain.invalid writes:

(1) forke$B$r$D$+$C$F$b$h$$$G$9$+e(B? e$B$?$V$se(BWindowse$B$GF0e(B
e$B:n$7$^$;$s!#e(B
(2) e$B%]!<%?%V%k$J%F%9%H$,$+$1$J$$5$$,$7$^$9$,!"$J$/$F$b$+$^$$e(B
e$B$^$;$s$+!)e(B
open3e$B$H$+$I$&$7$F$k$s$@$m!#e(B

Ruby 1.9 e$B$Ne(B open3 e$B$Oe(B fork e$B%a%=%C%I$r;H$C$F$$$^$;$s!#e(B

e$B$=$+!"e(Bopen3e$B$Oe(Bspawne$B$r;H$C$F$k$s$G$9$M!#e(B

e$B%V%m%C%/$r%5%V%W%m%;%9$GI>2A$5$;$kJ}K!$O$"$j$^$9$+!)e(B
forke$B$,$G$-$J$$4D6-$G$O!"%9%l%C%I$GF0:n$9$k$h$&$J$b$Ne(B
e$B$K$7$?$i$$$$$N$+$J$"!#e(B

Windowse$B$J$Ie(Bforke$B$,$G$-$J$$4D6-$G$Oe(Bforke$B$r;H$&$H$I$se(B
e$B$JNc30$,e(B
e$B$"$,$k$s$G$7$g$&$+!#e(B
forke$B$9$kA0$Ke(Bforke$B$G$-$J$$$+$I$&$+!"CN$k$3$H$O$G$-$^$9$+e(B?

1.9e$B$Ne(Blibe$B$NCf$G$Oe(Bshell/process-controller.rbe$B$He(B
shell/process-controller.rbe$B!"e(Bwebrick/server.rbe$B$,e(B
forke$B$r;H$C$F$k$h$&$G$9!#e(B
forke$B$rHr$1$kI,MW$O$J$$$N$+$7$i$s!#e(B


#4

In article removed_email_address@domain.invalid,
Masatoshi SEKI removed_email_address@domain.invalid writes:

e$B%V%m%C%/$r%5%V%W%m%;%9$GI>2A$5$;$kJ}K!$O$"$j$^$9$+!)e(B

spawn e$B$K$O$"$j$^$;$s!#e(B


#5

e$B$3$s$K$A$O!"$J$+$`$ie(B(e$B$&e(B)e$B$G$9!#e(B

In message “[ruby-dev:38223] Re: rinda/eval.rb”
on Mar.31,2009 19:01:32, removed_email_address@domain.invalid wrote:

Windowse$B$J$Ie(Bforke$B$,$G$-$J$$4D6-$G$Oe(Bforke$B$r;H$&$H$I$se(B
e$B$JNc30$,e(B
e$B$"$,$k$s$G$7$g$&$+!#e(B

NotImplementedError e$B$G$9!#e(B

forke$B$9$kA0$Ke(Bforke$B$G$-$J$$$+$I$&$+!"CN$k$3$H$O$G$-$^$9$+e(B?

e$B$G$-$^$;$s!#e(B

e$B$3$NJU$r$I$&$K$+$G$-$J$$$+$H$$$&OC$,0JA0$"$C$?$h$&$Je(B…

1.9e$B$Ne(Blibe$B$NCf$G$Oe(Bshell/process-controller.rbe$B$He(B
shell/process-controller.rbe$B!"e(Bwebrick/server.rbe$B$,e(B
forke$B$r;H$C$F$k$h$&$G$9!#e(B
forke$B$rHr$1$kI,MW$O$J$$$N$+$7$i$s!#e(B

e$BE:IU$NA45!G=$rC/$+$,<+F0E*$K3NG’$7$F$/$l$F$k$o$1$G$O$J$$$N$G!"e(B
make test-alle$B$G3NG’$5$l$J$$5!G=$OC1$KB8:_$rL5;k$5$l$F$$$k$@$1e(B
e$B$+$H;W$$$^$9!#e(B

e$B$=$l$G$O!#e(B


#6

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:38233] Re: rinda/eval.rb”
on Wed, 1 Apr 2009 18:13:27 +0900, Tanaka A. removed_email_address@domain.invalid
writes:

|e$B0JA0e(B [ruby-dev:34707] e$B$G=q$-$^$7$?$,!"e(BNotImplementedError e$B$Ke(B
|e$B$J$k$@$1$N%a%=%C%I$O@UL3$r2L$?$7$F$$$k$H$O$$$($J$$$N$G!“e(B
|respond_to? e$B$G56$rJV$9$N$,$$$$$H;W$$$^$9!#e(B
|
|e$B$3$l$,$”$l$P!"e(BProcess.respond_to?(:fork) e$B$Ge(B fork e$B$G$-$k$+$Ie(B
|e$B$&$+H=CG$G$-$k$h$&$K$J$j$^$9!#e(B
|
|e$B$7$+$b!"C1=c$K%a%=%C%I$r$J$/$9$N$H0[$J$j!"8F$V$He(B
|NotImplementedError e$B$rH/@8$9$k$N$OJQ$o$i$J$$$N$G!"e(B
|NotImplementedError e$B$re(B rescue e$B$9$k$H$$$&MQK!$OJQ$($:$K:Q$_!“e(B
|e$B$^$?!“e(BNoMethodError/NameError e$B$re(B rescue e$B$9$k$H$$$&7uF]$J$3$He(B
|e$B$r4+$a$F$7$^$&$3$H$b$”$j$^$;$s!#e(B
|
|e$B$;$C$+$/$J$N$G%”%C%W%G!<%H$7$?%Q%C%A$r$D$1$F$*$-$^$9!#e(B

e$B$$$m$$$m9M$($^$7$?$,!"$3$l!“F~$l$F$b$h$$$h$&$J5$$,$7$FMh$^$7e(B
e$B$?!#$,!”%?%$%_%s%0$,!#e(B1.9.2e$B$KF~$l$F$h$$$b$s$@$+!#$I$&$9$k$+$He(B
e$B$+$NH=CG$Oe(BYuguie$B$5$s$KG$$;$A$c$&$K$7$F$b!"$J$s$+!"$3$&$d$C$Fe(B
e$B!VF~$l$F$bNI$$$H;W$C$F$k$1$Ie(B1.9.2e$B$K$O$I$&$+!W$H$+9M$($k$N$Oe(B
e$B$a$s$I$/$5$/$J$C$F$-$A$c$C$?$J!#e(Btrunke$B$K>!<j$KF~$l$A$c$&$+!#e(B

e$B$+!"e(B2.0 to bee$B$N%V%i%s%A$r@Z$k$+!#e(B


#7

e$B$3$s$K$A$O!"$J$+$`$ie(B(e$B$&e(B)e$B$G$9!#e(B

In message “[ruby-dev:38259] Re: rinda/eval.rb”
on Apr.03,2009 09:22:39, removed_email_address@domain.invalid wrote:

e$B$$$m$$$m9M$($^$7$?$,!"$3$l!“F~$l$F$b$h$$$h$&$J5$$,$7$FMh$^$7e(B
e$B$?!#$,!”%?%$%_%s%0$,!#e(B1.9.2e$B$KF~$l$F$h$$$b$s$@$+!#$I$&$9$k$+$He(B
e$B$+$NH=CG$Oe(BYuguie$B$5$s$KG$$;$A$c$&$K$7$F$b!"$J$s$+!"$3$&$d$C$Fe(B
e$B!VF~$l$F$bNI$$$H;W$C$F$k$1$Ie(B1.9.2e$B$K$O$I$&$+!W$H$+9M$($k$N$Oe(B
e$B$a$s$I$/$5$/$J$C$F$-$A$c$C$?$J!#e(Btrunke$B$K>!<j$KF~$l$A$c$&$+!#e(B

e$B$H!"$$$&$3$H$,IQH/$9$k$H$$$&$3$H$O!"e(Bruby_1_9e$B%V%i%s%A$,@Z$i$le(B
e$B$k$Y$-$@$H$$$&$3$H$G$O$J$$$G$7$g$&$+$M!#e(B

e$B$=$l$G$O!#e(B


#8

At Fri, 3 Apr 2009 09:45:54 +0900,
U.Nakamura wrote:

In message “[ruby-dev:38259] Re: rinda/eval.rb”
on Apr.03,2009 09:22:39, removed_email_address@domain.invalid wrote:

いろいろ考えましたが、これ、入れてもよいような気がして来まし
た。が、タイミングが。1.9.2に入れてよいもんだか。どうするかと
かの判断はYuguiさんに任せちゃうにしても、なんか、こうやって
「入れても良いと思ってるけど1.9.2にはどうか」とか考えるのは
めんどくさくなってきちゃったな。trunkに勝手に入れちゃうか。

ã¨ã€ã„ã†ã“ã¨ãŒé »ç™ºã™ã‚‹ã¨ã„ã†ã“ã¨ã¯ã€ruby_1_9ブランチが切られ
るべきだということではないでしょうかね。

 そうですね。ruby 1.9.1 との互換性もさりながら、 1.8 との互換性の
呪縛から完全に解き放たれるためにも数字を上げて訣別したいところです。

 ABIバージョンの分離の明確化やバージョン番号の再定義も 2.x.x を
機に進めたいですね。あとは互換性に関する警告のフレームワークとか。


#9

In article removed_email_address@domain.invalid,
“U.Nakamura” removed_email_address@domain.invalid writes:

forke$B$9$kA0$Ke(Bforke$B$G$-$J$$$+$I$&$+!"CN$k$3$H$O$G$-$^$9$+e(B?

e$B$G$-$^$;$s!#e(B

e$B$3$NJU$r$I$&$K$+$G$-$J$$$+$H$$$&OC$,0JA0$"$C$?$h$&$Je(B…

e$B0JA0e(B [ruby-dev:34707] e$B$G=q$-$^$7$?$,!"e(BNotImplementedError
e$B$Ke(B
e$B$J$k$@$1$N%a%=%C%I$O@UL3$r2L$?$7$F$$$k$H$O$$$($J$$$N$G!"e(B
respond_to? e$B$G56$rJV$9$N$,$$$$$H;W$$$^$9!#e(B

e$B$3$l$,$"$l$P!"e(BProcess.respond_to?(:fork) e$B$Ge(B fork
e$B$G$-$k$+$Ie(B
e$B$&$+H=CG$G$-$k$h$&$K$J$j$^$9!#e(B

e$B$7$+$b!"C1=c$K%a%=%C%I$r$J$/$9$N$H0[$J$j!"8F$V$He(B
NotImplementedError e$B$rH/@8$9$k$N$OJQ$o$i$J$$$N$G!"e(B
NotImplementedError e$B$re(B rescue e$B$9$k$H$$$&MQK!$OJQ$($:$K:Q$_!"e(B
e$B$^$?!“e(BNoMethodError/NameError e$B$re(B rescue
e$B$9$k$H$$$&7uF]$J$3$He(B
e$B$r4+$a$F$7$^$&$3$H$b$”$j$^$;$s!#e(B

e$B$;$C$+$/$J$N$G%"%C%W%G!<%H$7$?%Q%C%A$r$D$1$F$*$-$^$9!#e(B

% svn diff --diff-cmd diff -x ‘-u -p’
Index: include/ruby/intern.h

— include/ruby/intern.h (revision 23107)
+++ include/ruby/intern.h (working copy)
@@ -273,6 +273,8 @@ int rb_method_basic_definition_p(VALUE,
VALUE rb_eval_cmd(VALUE, VALUE, int);
int rb_obj_respond_to(VALUE, ID, int);
int rb_respond_to(VALUE, ID);
+void rb_define_notimplement_method_id(VALUE mod, ID id, int noex);
+VALUE rb_f_notimplement(int argc, VALUE *argv, VALUE obj);
void rb_interrupt(void);
VALUE rb_apply(VALUE, ID, VALUE);
void rb_backtrace(void);
Index: proc.c

— proc.c (revision 23107)
+++ proc.c (working copy)
@@ -1041,6 +1041,15 @@ method_owner(VALUE obj)
return data->oclass;
}

+static VALUE
+method_notimplemented_p(VALUE obj)
+{

  • struct METHOD *data;
  • Data_Get_Struct(obj, struct METHOD, data);
  • return rb_notimplement_body_p(data->body) ? Qtrue : Qfalse;
    +}

/*

  • call-seq:
  • obj.method(sym)    => method
    

@@ -1616,6 +1625,9 @@ method_inspect(VALUE method)
}
rb_str_buf_cat2(str, sharp);
rb_str_append(str, rb_id2str(data->oid));

  • if (rb_notimplement_body_p(data->body)) {

  •    rb_str_buf_cat2(str, " (notimplemented)");
    
  • }
    rb_str_buf_cat2(str, “>”);

    return str;
    @@ -1934,6 +1946,7 @@ Init_Proc(void)
    rb_define_method(rb_cMethod, “name”, method_name, 0);
    rb_define_method(rb_cMethod, “owner”, method_owner, 0);
    rb_define_method(rb_cMethod, “unbind”, method_unbind, 0);

  • rb_define_method(rb_cMethod, “notimplemented?”,
    method_notimplemented_p, 0);
    rb_define_method(rb_cMethod, “source_location”, rb_method_location,
    0);
    rb_define_method(rb_cMethod, “parameters”, rb_method_parameters,
    0);
    rb_define_method(rb_mKernel, “method”, rb_obj_method, 1);
    @@ -1953,6 +1966,7 @@ Init_Proc(void)
    rb_define_method(rb_cUnboundMethod, “name”, method_name, 0);
    rb_define_method(rb_cUnboundMethod, “owner”, method_owner, 0);
    rb_define_method(rb_cUnboundMethod, “bind”, umethod_bind, 1);

  • rb_define_method(rb_cUnboundMethod, “notimplemented?”,
    method_notimplemented_p, 0);
    rb_define_method(rb_cUnboundMethod, “source_location”,
    rb_method_location, 0);
    rb_define_method(rb_cUnboundMethod, “parameters”,
    rb_method_parameters, 0);

Index: vm_method.c

— vm_method.c (revision 23107)
+++ vm_method.c (working copy)
@@ -24,6 +24,8 @@ static struct cache_entry cache[CACHE_SI
#define ruby_running (GET_VM()->running)
/* int ruby_running = 0; */

+static NODE *notimplement_body = 0;
+
void
rb_clear_cache(void)
{
@@ -414,6 +416,12 @@ rb_export_method(VALUE klass, ID name, I
}

int
+rb_notimplement_body_p(NODE *method)
+{

  • return method == notimplement_body ? Qtrue : Qfalse;
    +}

+int
rb_method_boundp(VALUE klass, ID id, int ex)
{
NODE *method;
@@ -422,6 +430,8 @@ rb_method_boundp(VALUE klass, ID id, int
if (ex && (method->nd_noex & NOEX_PRIVATE)) {
return Qfalse;
}

  •    if (rb_notimplement_body_p(method->nd_body))
    
  •       return Qfalse;
    
    return Qtrue;
    }
    return Qfalse;
    @@ -811,6 +821,42 @@ rb_mod_alias_method(VALUE mod, VALUE new
    return mod;
    }

+VALUE
+rb_f_notimplement(int argc, VALUE *argv, VALUE obj)
+{

  • rb_notimplement();
    +}

+void
+rb_define_notimplement_method_id(VALUE mod, ID id, int noex)
+{

  • rb_add_method(mod, id, notimplement_body, noex);
    +}

+static VALUE
+rb_mod_notimplemented_method(int argc, VALUE *argv, VALUE mod)
+{

  • int i;
  • if (rb_vm_cbase() == rb_cObject && mod == rb_cObject) {
  •    rb_secure(4);
    
  • }
  • for (i = 0; i < argc; i++) {
  •    ID id = rb_to_id(argv[i]);
    
  •    if (rb_safe_level() >= 4 && !OBJ_UNTRUSTED(mod)) {
    
  •        rb_raise(rb_eSecurityError, "Insecure: can't undef `%s'",
    
  •                 rb_id2name(id));
    
  •    }
    
  •    rb_frozen_class_p(mod);
    
  •    if (id == object_id || id == id__send__ || id == idInitialize) 
    

{

  •        rb_warn("notimplementing `%s' may cause serious problem", 
    

rb_id2name(id));

  •    }
    
  •   rb_define_notimplement_method_id(mod, id, NOEX_PUBLIC);
    
  • }
  • return mod;
    +}

static void
secure_visibility(VALUE self)
{
@@ -1137,5 +1183,9 @@ Init_eval_method(void)
singleton_removed = rb_intern(“singleton_method_removed”);
undefined = rb_intern(“method_undefined”);
singleton_undefined = rb_intern(“singleton_method_undefined”);
+

  • rb_global_variable(&notimplement_body);
  • notimplement_body = NEW_CFUNC(rb_f_notimplement, -1);
  • rb_define_private_method(rb_cModule, “notimplemented_method”,
    rb_mod_notimplemented_method, -1);
    }

Index: class.c

— class.c (revision 23107)
+++ class.c (working copy)
@@ -807,25 +807,36 @@ rb_obj_singleton_methods(int argc, VALUE
void
rb_define_method_id(VALUE klass, ID name, VALUE (*func)(ANYARGS), int
argc)
{

  • rb_add_method(klass, name, NEW_CFUNC(func,argc), NOEX_PUBLIC);
  • if (func == rb_f_notimplement)
  •    rb_define_notimplement_method_id(klass, name, NOEX_PUBLIC);
    
  • else
  •    rb_add_method(klass, name, NEW_CFUNC(func,argc), NOEX_PUBLIC);
    

}

void
rb_define_method(VALUE klass, const char *name, VALUE (*func)(ANYARGS),
int argc)
{

  • rb_add_method(klass, rb_intern(name), NEW_CFUNC(func, argc),
    NOEX_PUBLIC);
  • rb_define_method_id(klass, rb_intern(name), func, argc);
    }

void
rb_define_protected_method(VALUE klass, const char *name, VALUE
(*func)(ANYARGS), int argc)
{

  • rb_add_method(klass, rb_intern(name), NEW_CFUNC(func, argc),
    NOEX_PROTECTED);
  • ID id = rb_intern(name);
  • if (func == rb_f_notimplement)
  •    rb_define_notimplement_method_id(klass, id, NOEX_PROTECTED);
    
  • else
  •    rb_add_method(klass, id, NEW_CFUNC(func, argc), 
    

NOEX_PROTECTED);
}

void
rb_define_private_method(VALUE klass, const char *name, VALUE
(*func)(ANYARGS), int argc)
{

  • rb_add_method(klass, rb_intern(name), NEW_CFUNC(func, argc),
    NOEX_PRIVATE);
  • ID id = rb_intern(name);
  • if (func == rb_f_notimplement)
  •    rb_define_notimplement_method_id(klass, id, NOEX_PRIVATE);
    
  • else
  •    rb_add_method(klass, id, NEW_CFUNC(func, argc), NOEX_PRIVATE);
    

}

void
Index: process.c

— process.c (revision 23107)
+++ process.c (working copy)
@@ -2601,10 +2601,10 @@ rb_fork(int *status, int (chfunc)(void

  • fork doesn’t copy other threads.
    */

+#if defined(HAVE_FORK) && !defined(CANNOT_FORK_WITH_PTHREAD)
static VALUE
rb_f_fork(VALUE obj)
{
-#if defined(HAVE_FORK) && !defined(CANNOT_FORK_WITH_PTHREAD)
rb_pid_t pid;

 rb_secure(2);

@@ -2630,11 +2630,10 @@ rb_f_fork(VALUE obj)
default:
return PIDT2NUM(pid);
}
+}
#else

  • rb_notimplement();
    +#define rb_f_fork rb_f_notimplement
    #endif
    -}

/*

  • call-seq:
    Index: test/ruby/test_notimp.rb
    ===================================================================
    — test/ruby/test_notimp.rb (revision 0)
    +++ test/ruby/test_notimp.rb (revision 0)
    @@ -0,0 +1,33 @@
    +require ‘test/unit’

+class TestNotImplement < Test::Unit::TestCase

  • class C
  • notimplemented_method :n
  • def x() end
  • end
  • def test_respond_to
  • assert_equal(false, C.new.respond_to?(:n))
  • assert_equal(true, C.new.respond_to?(:x))
  • end
  • def test_call
  • assert_raise(NotImplementedError) { C.new.n }
  • assert_nothing_raised { C.new.x }
  • end
  • def test_method
  • m = C.new.method(:n)
  • assert(m.notimplemented?)
  • m = C.new.method(:x)
  • assert(!m.notimplemented?)
  • end
  • def test_umethod
  • m = C.instance_method(:n)
  • assert(m.notimplemented?)
  • m = C.instance_method(:x)
  • assert(!m.notimplemented?)
  • end

+end
Index: file.c

— file.c (revision 23107)
+++ file.c (working copy)
@@ -1926,12 +1926,7 @@ rb_file_s_lchmod(int argc, VALUE *argv)
return LONG2FIX(n);
}
#else
-static VALUE
-rb_file_s_lchmod(int argc, VALUE *argv)
-{

  • rb_notimplement();
  • return Qnil; /* not reached */
    -}
    +#define rb_file_s_lchmod rb_f_notimplement
    #endif

struct chown_args {


#10

e$B$3$s$K$A$O!"$J$+$`$ie(B(e$B$&e(B)e$B$G$9!#e(B

In message “[ruby-dev:38233] Re: rinda/eval.rb”
on Apr.01,2009 18:13:27, removed_email_address@domain.invalid wrote:

e$B$^$?!“e(BNoMethodError/NameError e$B$re(B rescue e$B$9$k$H$$$&7uF]$J$3$He(B
e$B$r4+$a$F$7$^$&$3$H$b$”$j$^$;$s!#e(B

e$B$3$NJU$O40A4$KF10U$7$^$9!#e(B

e$B$;$C$+$/$J$N$G%"%C%W%G!<%H$7$?%Q%C%A$r$D$1$F$*$-$^$9!#e(B

e$B$,!"e(Brubye$B%l%Y%k$G2DG=$K$9$kI,MW$O$J$$$s$8$c$J$$$G$7$g$&$+$M!#e(B

e$B$=$l$G$O!#e(B


#11

e$B$3$s$K$A$O!"$J$+$`$ie(B(e$B$&e(B)e$B$G$9!#e(B
[ruby-dev:38260]e$B$G=q$-K:$l$?$s$G$9$,!"e(B

In message “[ruby-dev:38259] Re: rinda/eval.rb”
on Apr.03,2009 09:22:39, removed_email_address@domain.invalid wrote:

e$B$$$m$$$m9M$($^$7$?$,!"$3$l!“F~$l$F$b$h$$$h$&$J5$$,$7$FMh$^$7e(B
e$B$?!#$,!”%?%$%_%s%0$,!#e(B1.9.2e$B$KF~$l$F$h$$$b$s$@$+!#$I$&$9$k$+$He(B

e$B!V8F$s$Ge(BNotImplementedErrore$B$,5/$-$k$+$I$&$+8+$J$$$H;H$($k$+$Ie(B
e$B$&$+$o$+$i$s!W$H$$$&;v>]<+BN$,LdBj$G$"$k$J$i$P!"8_49@-$NLdBje(B
e$B$rL5;k$7$F$h$1$l$P!"e(Bforke$B$N$h$&$JNc$O$=$b$=$b$=$N$h$&$J4D6-$Ge(B
e$B$O%a%=%C%I$rDj5A$9$Y$-$G$O$J$$$H;W$$$^$9!#e(B

e$BA0$K5Q2<$5$l$?5$$b$7$^$9$,e(B…

2.0e$B$G$I$3$^$G8_49@-$r0];}$9$k$D$b$j$J$N$+$H$$$&$N$O6=L#?<$$$He(B
e$B$3$m$J$N$G$9$,!";d8+$H$7$F$O$3$NJU$j$O8_49@-$r<N$F$F$b@0M}$9e(B
e$B$Y$-$H$3$m$@$H9M$($^$9!#e(B
e$B$=$&$G$"$l$P!":#2s$N;EAH$_$Oe(B2.0e$B$G$O$J$/e(B1.9e$B7ONs$KF~$k$Y$-$b$Ne(B
e$B$@$H;W$$$^$9!#e(B
1.8e$B$G$Oe(BNotImplementedErrore$B!"e(B1.9e$B$G$Oe(BNotImplementedErrore$B$+$De(B
respond_to?e$B$,e(Bfalsee$B!“e(B2.0e$B$G$Oe(Brespond_to?e$B$,e(Bfalsee$B!”$H$J$k$N$,0\9Te(B
e$B%Q%9$H$7$FK>$^$7$$$N$G$O$J$$$G$7$g$&$+!#e(B

e$B$=$l$G$O!#e(B


#12

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:38264] Re: rinda/eval.rb”
on Fri, 3 Apr 2009 12:00:31 +0900, “Akinori MUSHA”
removed_email_address@domain.invalid writes:

|> e$B$=$&$G$"$l$P!":#2s$N;EAH$$Oe(B2.0e$B$G$O$J$/e(B1.9e$B7ONs$KF~$k$Y$-$b$Ne(B
|> e$B$@$H;W$$$^$9!#e(B
|> 1.8e$B$G$Oe(BNotImplementedErrore$B!“e(B1.9e$B$G$Oe(BNotImplementedErrore$B$+$De(B
|> respond_to?e$B$,e(Bfalsee$B!“e(B2.0e$B$G$Oe(Brespond_to?e$B$,e(Bfalsee$B!”$H$J$k$N$,0\9Te(B
|> e$B%Q%9$H$7$FK>$^$7$$$N$G$O$J$$$G$7$g$&$+!#e(B
|
|e$B!!;?@.$G$9!#!Ve(BNotImplementedError e$B$+$De(B respond_to?e$B!W$H$$$&$N$Oe(B
|e$B8_49@-$N$?$a$N2aEOE*$JA<CV$K2a$.$J$$$N$G!”$=$&$7$?%a%=%C%I$re(B
|e$B$3$l$+$i@
$1$k$3$H$r=uD9$7$J$$$?$a$K$b!"e(BRubye$B%l%Y%k$Ne(BAPIe$B$ODs6!e(B
|e$B$;$:$Ke(B1.9e$B$K$N$_<BAu$9$k$N$,$$$$$H;W$$$^$9!#e(B

e$B$U$`!"6=L#?<$$;kE@$G$9$M!#$=$N$h$&$K9M$($F$O$$$^$;$s$G$7$?$,!“e(B
e$B0lM}$”$j$^$9!#e(B


#13

At Fri, 3 Apr 2009 11:45:19 +0900,
U.Nakamura wrote:

2.0でどこまで互換性を維持するつもりなのかというのは興味深いと
ころなのですが、私見としてはこの辺りは互換性を捨てても整理す
べきところだと考えます。
そうであれば、今回の仕組みは2.0ではなく1.9系列に入るべきもの
だと思います。
1.8ではNotImplementedError、1.9ではNotImplementedErrorかつ
respond_to?がfalse、2.0ではrespond_to?がfalse、となるのが移行
パスとして望ましいのではないでしょうか。

 賛成です。「NotImplementedError かつ respond_to?」というのは
互換性のための過渡的な措置に過ぎないので、そうしたメソッドを
これから設けることを助長しないためにも、RubyレベルのAPIは提供
せずに1.9にのみ実装するのがいいと思います。


#14

In article removed_email_address@domain.invalid,
“U.Nakamura” removed_email_address@domain.invalid writes:

e$B!V8F$s$Ge(BNotImplementedErrore$B$,5/$-$k$+$I$&$+8+$J$$$H;H$($k$+$Ie(B
e$B$&$+$o$+$i$s!W$H$$$&;v>]<+BN$,LdBj$G$"$k$J$i$P!"8_49@-$NLdBje(B
e$B$rL5;k$7$F$h$1$l$P!"e(Bforke$B$N$h$&$JNc$O$=$b$=$b$=$N$h$&$J4D6-$Ge(B
e$B$O%a%=%C%I$rDj5A$9$Y$-$G$O$J$$$H;W$$$^$9!#e(B

e$BA0$K5Q2<$5$l$?5$$b$7$^$9$,e(B…

e$B:G=E$K%f!<%6%3!<%I$O$I$&$$$&7A$G=q$/$N$,K>$^$7$$$+!"$H$$$&e(B
e$B$3$H$J$s$G$9$,!";d$O8=:_$Ne(B NotImplementedError e$B$re(B rescue
e$B$9e(B
e$B$k%9%?%$%k$O4pK\E*$KNI$$%9%?%$%k$@$H;W$C$F$$$^$9!#e(B

begin
fork { … }
rescue NotImplementedError

end

e$B$3$N%9%?%$%k$NMxE@$O!"e(Btypo e$B$N8!=PG=NO$,9b$$$3$H$G$9!#e(Bfork
e$B$re(B
e$B=q$-4V0c$($?>l9g!"30B&$Ke(B NoMethodError e$B$,EA$o$j$^$9!#$3$N8!e(B
e$B=PG=NO$Oe(B fork e$B$,F0:n$9$k%W%i%C%H%U%)!<%`$+$I$&$+$K0MB8$7$^$;e(B
e$B$s!#$^$?!"e(Bfork e$B$H$$$&L>A0$Oe(B
1e$B2s=q$/$@$1$GNI$$$H$$$&$N$be(B typo
e$B$N2DG=@-$r8:$i$7$^$9!#e(B

e$B$=$l$KBP$7!"e(Brespond_to? e$B$r;H$&%9%?%$%k$Oe(B typo
e$B$N8!=PG=NO$,Nte(B
e$B$j$^$9!#e(B

if Process.respond_to? :fork
fork { … }
else

end

fork e$B$He(B 2e$B2s=q$+$J$1$l$P$J$j$^$;$s$7!"$H$/$Ke(B respond_to?
e$B$N0ze(B
e$B?t$Ne(B :fork e$B$re(B typo e$B$9$k$H!“e(Belse
e$B@a$,<B9T$5$l!”$=$NFbMF$K$h$je(B
e$B$^$9$,$=$Ne(B typo
e$B$,8!=P$5$l$J$$$+$b$7$l$^$;$s!#$=$7$F$b$A$m$s!"e(B
fork e$B%a%=%C%I$N8F$S=P$7$N$H$3$m$Ne(B typo e$B$O!"e(Bfork
e$B$N$J$$%W%i%Ce(B
e$B%H%U%)!<%`$G$O8!=P$G$-$^$;$s!#e(B

e$B$7$+$7!"e(Bfork e$B$N$J$$%W%i%C%H%U%)!<%`$Ge(B fork
e$B%a%=%C%I$rDj5A$7e(B
e$B$J$$$h$&$K$9$k$H!"A0<T$N%9%?%$%k$O;H$($J$/$J$j$^$9!#$=$N%9%?e(B
e$B%$%k$G=q$1$Pe(B

begin
fork { … }
rescue NoMethodError

end

e$B$H$J$j$^$9$,!"$3$l$Oe(B typo e$B$N8!=PG=NO$r<:$C$F$$$^$9!#e(Btypo
e$B$Oe(B
NoMethodError e$B$rH/@8$5$;$^$9$,!"$=$l$Oe(B rescue e$B$5$l$F$7$^$$$^e(B
e$B$9!#e(B

e$B$H$$$&$o$1$G!";d$Oe(B fork e$B$,$J$$4D6-$Ge(B NotImplementedError
e$B$Ke(B
e$B$J$k$N$ONI$$$3$H$G$"$k!"$H;W$C$F$$$^$9!#e(B

e$B<B9T$;$:$Ke(B fork
e$B$,F0$/$+D4$Y$?$$$H$$$&MW5a$r<B8=$9$k$N$K$"$?$Ce(B
e$B$F!"$=$NNI$5$r<:$&I,MW$,$"$k$+$H$$$($P!";d$N%Q%C%A$G<B8=$G$-e(B
e$B$k$h$&$K!"$Y$D$K<:$&I,MW$O$"$j$^$;$s!#e(B

e$B$H$$$&$o$1$G;d$O!";d$NDs0F$,<B8=$9$k5sF0$r2aEOE*$J$b$N$@$H$Oe(B
e$B;W$C$F$$$^$;$s!#$`$7$m!"$3$N5sF0$,NI$$$N$@!"$H;W$C$F$$$^$9!#e(B

e$B$8$D$O!"%a%=%C%I$rDj5A$7$J$$$H$$$&$N$O!“e(B
Process.{getrlimit,setrlimit} e$B$r<BAu$7$?;~$K$7$P$i$/;n$7$?$se(B
e$B$G$9$,!“7k6I!”>e5-$N$h$&$J$3$H$r9M$($K$$$?$C$F>o$KDj5A$9$k$3e(B
e$B$H$K$7$?$H$$$&7P0^$,$”$j$^$9!#e(B


#15

At Fri, 3 Apr 2009 14:53:13 +0900,
Tanaka A. wrote:

e$B$H$$$&$o$1$G!";d$Oe(B fork e$B$,$J$$4D6-$Ge(B NotImplementedError e$B$Ke(B
e$B$J$k$N$ONI$$$3$H$G$"$k!"$H;W$C$F$$$^$9!#e(B

e$B<B9T$;$:$Ke(B fork e$B$,F0$/$+D4$Y$?$$$H$$$&MW5a$r<B8=$9$k$N$K$"$?$Ce(B
e$B$F!"$=$NNI$5$r<:$&I,MW$,$"$k$+$H$$$($P!";d$N%Q%C%A$G<B8=$G$-e(B
e$B$k$h$&$K!"$Y$D$K<:$&I,MW$O$"$j$^$;$s!#e(B

e$B$H$$$&$o$1$G;d$O!";d$NDs0F$,<B8=$9$k5sF0$r2aEOE*$J$b$N$@$H$Oe(B
e$B;W$C$F$$$^$;$s!#$`$7$m!"$3$N5sF0$,NI$$$N$@!"$H;W$C$F$$$^$9!#e(B

e$B!!$J$k$[$I!#e(BNotImplementedError
e$B$N0U5A$K$D$$$F$OM}2r$7$^$7$?!#e(B

e$B!!$?$@!"e(B respond_to? e$B$K$$1$ke(B typo
e$B$N%j%9%/$r6D$k$J$i$J$
$5$i!"e(B
respond_to? e$B$G$NH=Dj$r=uD9$9$k$h$&$JJQ99$O$h$/$J$$$H;W$$$^$9!#e(B
(1.8/1.9.1e$B$H$N8_49@-$r9M$($F$NDs0F$@$H$O;W$&$N$G$9$,e(B)

e$B!!C<E*$K8@$($Pe(B Process.respond_to?(:fork)
e$B$H%7%s%%k$GEO$9$+$ie(B
typo e$B$,8+2a$4$5$l$&$k$N$G$"$C$F!"$b$7e(B Process.forkable? e$B$H$+e(B
Process.implement?(Process::FEATURE_FORK) e$B$N$h$&$J<jCJ$,MQ0Ue(B
e$B$5$l$k$N$G$"$l$P$=$&$7$?LdBj$O$J$$$o$1$G$9!#e(B

e$B!!e(BNotImplementedError e$B$NJaB*$G%+%P!<$G$-$J$$%1!<%9$H$7$F$O!“e(B
e$B$?$H$($Pe(B fork e$B$9$kA0$KI{:nMQ$N$”$kA0=hM}$,I,MW$J$N$G!“e(B fork
e$B$9$kCJ$K$J$C$Fe(B NotImplementedError
e$B$r=P$5$l$F$bBeBX<jCJ$K@Z$je(B
e$BBX$($i$l$J$$!”$H$$$C$?>u67$,5s$2$i$l$^$9!#e(B

e$B!!$h$C$F2?$i$+$NH=Dj<jCJ$OI,MW$@$,!“e(B respond_to?
e$B$O$U$5$o$7$/e(B
e$B$J$$$N$G$O$J$$$+!”$H$$$&$N$,$3$3$G$N;d$N9M$($G$9!#e(B

e$B!!$5$i$J$kG:$_$H$7$F$O!"$b$72>$Ke(B Process.forkable? e$B$N$h$&$Je(B
e$B%a%=%C%I$rMQ0U$7!">e=R$N%a%=%C%I$,KAF,$Ge(B

Process.forkable? or raise NotImplementedError

e$B$H$7$?$H$7$F$b!"$J$*$=$N%a%=%C%I<+BN$Ke(B NotImplementedError
e$B$,e(B
e$B=P$J$$$+$r;vA0H=Dj$9$k<jCJ$,I,MW$K$J$j$=$&$@$H$$$&$3$H$G$9!#e(B


#16

e$B31$H$$$$$^$9!#e(B

On 2009/04/03, at 14:53, Tanaka A. wrote:
e$B!!e(B

e$B$3$N%9%?%$%k$NMxE@$O!"e(Btypo e$B$N8!=PG=NO$,9b$$$3$H$G$9!#e(Bfork
e$B$re(B
e$B=q$-4V0c$($?>l9g!"30B&$Ke(B NoMethodError e$B$,EA$o$j$^$9!#e(B
e$B$3$N8!e(B
e$B=PG=NO$Oe(B fork e$B$,F0:n$9$k%W%i%C%H%U%)!<%`$+$I$&$+$K0Me(B
e$BB8$7$^$;e(B
e$B$s!#$^$?!"e(Bfork e$B$H$$$&L>A0$Oe(B 1e$B2s=q$/$@$1$GNI$$$He(B
e$B$$$&$N$be(B typo
e$B$N2DG=@-$r8:$i$7$^$9!#e(B

e$B<+J,$G<ALd$7$H$$$F$J$s$J$s$G$9$,!Ee(B

e$B$9$Y$F$N%1!<%9$,$3$&$J$N$+$o$+$j$^$;$s$,!"e(Bforke$B$G$O8F$se(B
e$B$G$_$?$ie(B
NotImplementedErrore$B$,H/@8$9$k%9%?%$%k$,;H$$$d$9$$5$$,$7$^$9!#e(B

forke$B$HF1MM$J5!G=$Oe(Bforke$B$J$7$K$O4JC1$K$O<B8=$G$-$J$$$s$Ge(B
e$B$9$h$M!#e(B

MKS Toolkite$B$de(Bcygwine$B$O$I$&$7$F$k$s$@$m!#e(B

e$B:#2s=q$-$?$+$C$?$b$N$O%V%m%C%/IU$-e(Bforke$B$,$J$$$H$&$l$7$/e(B
e$B$J$$$b$Ne(B
e$B$@$C$?$N$G!"e(Bforke$B$,<BAu$5$l$J$$4D6-$G$O<B9T;~$KNc30$,H/@8$9$ke(B
e$B$b$N$K$7$^$9!#e(B
e$B%F%9%H$Oe(Bforke$B$,<BAu$5$l$J$$>l9g$K$O%9%-%C%W$7$F$_$h$&$He(B
e$B;W$$$^$9!#e(B


#17

In article removed_email_address@domain.invalid,
“Akinori MUSHA” removed_email_address@domain.invalid writes:

e$B!!$?$@!"e(B respond_to? e$B$K$$1$ke(B typo e$B$N%j%9%/$r6D$k$J$i$J$$5$i!"e(B
respond_to? e$B$G$NH=Dj$r=uD9$9$k$h$&$JJQ99$O$h$/$J$$$H;W$$$^$9!#e(B

e$B$O$$!#e(Btypo e$B$NE@$Ge(B respond_to?
e$B$,:GA1$G$J$$$3$H$K$OF10U$7$^$9!#e(B

respond_to? e$B$JM}M3$K$O!"e(Bduck typing
e$B$H$N6&DL2=$H!“Dj?t$d%a%=%Ce(B
e$B%I$rA}$d$5$J$$$G:Q$^$9$H$$$&E@$,$”$j$^$9!#e(B

e$B$I$A$i$b!"%f!<%6$,I,MW$H$9$kCN<1$r8:$i$9$H$$$&0U?^$G$9!#e(B

e$B$H$/$K!“e(Bduck typing e$B$H$N6&DL2=$O!”;H$($k$+$I$&$+$rH=Dj$9$k$Ke(B
e$B$Oe(B respond_to? e$B$r;H$&!"$H$$$&%f!<%6$NCN<1$r$G$-$k$@$13h$+$7e(B
e$B$F$$$-$?$$$H$$$&0UL#$,$"$j$^$9!#e(B

e$B!!C<E*$K8@$($Pe(B Process.respond_to?(:fork) e$B$H%7%s%%k$GEO$9$+$ie(B
typo e$B$,8+2a$4$5$l$&$k$N$G$"$C$F!"$b$7e(B Process.forkable? e$B$H$+e(B
Process.implement?(Process::FEATURE_FORK) e$B$N$h$&$J<jCJ$,MQ0Ue(B
e$B$5$l$k$N$G$"$l$P$=$&$7$?LdBj$O$J$$$o$1$G$9!#e(B

e$B$?$7$+$Ke(B typo e$B$NE@$G$O$=$A$i$,M-Mx$@$H;W$$$^$9!#e(B

e$B$?$@!"$3$l$O:#$^$G;H$C$F$$$J$+$C$?J}K!$rF3F~$9$k$N$G!"%f!<%6e(B
e$B$K?7$7$$CN<1$rMW5a$7$^$9!#e(B

e$B$^$?!"L>A0$,A}$($k$H$$$&E@$G$b3P$($k$3$H$,A}$($^$9!#e(B

e$B!!e(BNotImplementedError e$B$NJaB*$G%+%P!<$G$-$J$$%1!<%9$H$7$F$O!“e(B
e$B$?$H$($Pe(B fork e$B$9$kA0$KI{:nMQ$N$”$kA0=hM}$,I,MW$J$N$G!“e(B fork
e$B$9$kCJ$K$J$C$Fe(B NotImplementedError e$B$r=P$5$l$F$bBeBX<jCJ$K@Z$je(B
e$BBX$($i$l$J$$!”$H$$$C$?>u67$,5s$2$i$l$^$9!#e(B

e$B$O$$!#$=$l$,<B9T$;$:$KH=Dj$7$?$$!"$H$$$&MW5a$N860x$@$H;W$$$^e(B
e$B$9!#:#2s$Ne(B rinda e$B$O$=$&$G$O$J$+$C$?$h$&$G$9$,!#e(B

e$B!!$5$i$J$kG:$_$H$7$F$O!"$b$72>$Ke(B Process.forkable? e$B$N$h$&$Je(B
e$B%a%=%C%I$rMQ0U$7!">e=R$N%a%=%C%I$,KAF,$Ge(B

Process.forkable? or raise NotImplementedError

e$B$H$7$?$H$7$F$b!"$J$*$=$N%a%=%C%I<+BN$Ke(B NotImplementedError e$B$,e(B
e$B=P$J$$$+$r;vA0H=Dj$9$k<jCJ$,I,MW$K$J$j$=$&$@$H$$$&$3$H$G$9!#e(B

e$B$=$&$G$9$M!#:GBg$H$7$F$O!"<BAu$5$l$F$$$J$$$3$H$,$"$jF@$k%a%=%Ce(B
e$B%I$=$l$>$l$K$D$$$F$=$l$rH=Dj$9$k%a%=%C%I$dDj?t$,I,MW$K$J$j$^e(B
e$B$9!#e(B

e$B$=$&$d$C$F$D$/$C$F$$$/$H!“L>A0$O$”$kDxEY5,B’E*$K$O$J$k$G$7$ge(B
e$B$&$,!"$=$l$G$b$f$i$.$O$G$F$/$k$G$7$g$&$7!"7h$a$k$3$H!“3P$($ke(B
e$B$3$H!”$,B?$/$J$C$F$$$d$J$+$s$8$,$7$^$9!#e(B

e$B$?$H$($P!"e(BFile.truncate e$B$KBP$7$Fe(B
truncateable e$B$K$9$k$+e(B
truncatable e$B$K$9$k$+$H$+!#e(B

respond_to? e$B$N>l9g$O!“BP>]$N%a%=%C%I<+BN$NL>A0$r;H$&$N$G!”$=e(B
e$B$&$$$&G:$_$O$"$j$^$;$s!#e(B


#18

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:38297] Re: rinda/eval.rb”
on Thu, 9 Apr 2009 12:36:22 +0900, Tanaka A. removed_email_address@domain.invalid
writes:

|> e$B$$$m$$$m9M$($^$7$?$,!"$3$l!“F~$l$F$b$h$$$h$&$J5$$,$7$FMh$^$7e(B
|> e$B$?!#$,!”%?%$%_%s%0$,!#e(B1.9.2e$B$KF~$l$F$h$$$b$s$@$+!#$I$&$9$k$+$He(B
|> e$B$+$NH=CG$Oe(BYuguie$B$5$s$KG$$;$A$c$&$K$7$F$b!"$J$s$+!"$3$&$d$C$Fe(B
|
|e$B$H$j$"$($:!“e(Brespond_to? e$B$N5sF0$re(B 1.9 e$B$KF~$l$k$3$H$K$D$$$F$Oe(B
|e$B$@$l$bH?BP$7$F$J$$$N$G!”$^$:$=$3$+$i;O$a$k$H$$$&$N$,$$$$$s$8$ce(B
|e$B$J$$$G$9$+$M!#e(B

e$B$=$&$G$9$M!#e(BRubye$B%l%Y%k$Ge(B notimplemented?
e$B$H$$$&=R8l$rF3F~$9e(B
e$B$k$3$H$K$O;d$b>/!9Dq93$,$"$C$?$N$G!"$3$l$O<u$1F~$l$d$9$$BE6(e(B
e$BE@$G$9!#e(B


#19

In article removed_email_address@domain.invalid,
Yukihiro M. removed_email_address@domain.invalid writes:

e$B$$$m$$$m9M$($^$7$?$,!"$3$l!“F~$l$F$b$h$$$h$&$J5$$,$7$FMh$^$7e(B
e$B$?!#$,!”%?%$%_%s%0$,!#e(B1.9.2e$B$KF~$l$F$h$$$b$s$@$+!#$I$&$9$k$+$He(B
e$B$+$NH=CG$Oe(BYuguie$B$5$s$KG$$;$A$c$&$K$7$F$b!"$J$s$+!"$3$&$d$C$Fe(B

e$B$H$j$"$($:!“e(Brespond_to? e$B$N5sF0$re(B 1.9
e$B$KF~$l$k$3$H$K$D$$$F$Oe(B
e$B$@$l$bH?BP$7$F$J$$$N$G!”$^$:$=$3$+$i;O$a$k$H$$$&$N$,$$$$$s$8$ce(B
e$B$J$$$G$9$+$M!#e(B

Ruby e$B%l%Y%k$N%a%=%C%I$,$J$$$H%F%9%H$,$A$g$C$HLLE]$G$9$,!#e(B

e$B$I$&$G$7$g$&$+e(B yugui e$B$5$se(B?

% svn diff --diff-cmd diff -x ‘-u -p’
Index: include/ruby/intern.h

— include/ruby/intern.h (revision 23162)
+++ include/ruby/intern.h (working copy)
@@ -275,6 +275,8 @@ int rb_method_basic_definition_p(VALUE,
VALUE rb_eval_cmd(VALUE, VALUE, int);
int rb_obj_respond_to(VALUE, ID, int);
int rb_respond_to(VALUE, ID);
+void rb_define_notimplement_method_id(VALUE mod, ID id, int noex);
+VALUE rb_f_notimplement(int argc, VALUE *argv, VALUE obj);
void rb_interrupt(void);
VALUE rb_apply(VALUE, ID, VALUE);
void rb_backtrace(void);
Index: proc.c

— proc.c (revision 23162)
+++ proc.c (working copy)
@@ -1616,6 +1616,9 @@ method_inspect(VALUE method)
}
rb_str_buf_cat2(str, sharp);
rb_str_append(str, rb_id2str(data->oid));

  • if (rb_notimplement_body_p(data->body)) {

  •    rb_str_buf_cat2(str, " (not-implemented)");
    
  • }
    rb_str_buf_cat2(str, “>”);

    return str;
    Index: vm_method.c
    ===================================================================
    — vm_method.c (revision 23162)
    +++ vm_method.c (working copy)
    @@ -24,6 +24,8 @@ static struct cache_entry cache[CACHE_SI
    #define ruby_running (GET_VM()->running)
    /* int ruby_running = 0; */

+static NODE *notimplement_body = 0;
+
void
rb_clear_cache(void)
{
@@ -414,6 +416,12 @@ rb_export_method(VALUE klass, ID name, I
}

int
+rb_notimplement_body_p(NODE *method)
+{

  • return method == notimplement_body ? Qtrue : Qfalse;
    +}

+int
rb_method_boundp(VALUE klass, ID id, int ex)
{
NODE *method;
@@ -422,6 +430,8 @@ rb_method_boundp(VALUE klass, ID id, int
if (ex && (method->nd_noex & NOEX_PRIVATE)) {
return Qfalse;
}

  •    if (rb_notimplement_body_p(method->nd_body))
    
  •       return Qfalse;
    
    return Qtrue;
    }
    return Qfalse;
    @@ -811,6 +821,18 @@ rb_mod_alias_method(VALUE mod, VALUE new
    return mod;
    }

+VALUE
+rb_f_notimplement(int argc, VALUE *argv, VALUE obj)
+{

  • rb_notimplement();
    +}

+void
+rb_define_notimplement_method_id(VALUE mod, ID id, int noex)
+{

  • rb_add_method(mod, id, notimplement_body, noex);
    +}

static void
secure_visibility(VALUE self)
{
@@ -1137,5 +1159,8 @@ Init_eval_method(void)
singleton_removed = rb_intern(“singleton_method_removed”);
undefined = rb_intern(“method_undefined”);
singleton_undefined = rb_intern(“singleton_method_undefined”);
+

  • rb_global_variable(&notimplement_body);
  • notimplement_body = NEW_CFUNC(rb_f_notimplement, -1);
    }

Index: class.c

— class.c (revision 23162)
+++ class.c (working copy)
@@ -807,25 +807,36 @@ rb_obj_singleton_methods(int argc, VALUE
void
rb_define_method_id(VALUE klass, ID name, VALUE (*func)(ANYARGS), int
argc)
{

  • rb_add_method(klass, name, NEW_CFUNC(func,argc), NOEX_PUBLIC);
  • if (func == rb_f_notimplement)
  •    rb_define_notimplement_method_id(klass, name, NOEX_PUBLIC);
    
  • else
  •    rb_add_method(klass, name, NEW_CFUNC(func,argc), NOEX_PUBLIC);
    

}

void
rb_define_method(VALUE klass, const char *name, VALUE (*func)(ANYARGS),
int argc)
{

  • rb_add_method(klass, rb_intern(name), NEW_CFUNC(func, argc),
    NOEX_PUBLIC);
  • rb_define_method_id(klass, rb_intern(name), func, argc);
    }

void
rb_define_protected_method(VALUE klass, const char *name, VALUE
(*func)(ANYARGS), int argc)
{

  • rb_add_method(klass, rb_intern(name), NEW_CFUNC(func, argc),
    NOEX_PROTECTED);
  • ID id = rb_intern(name);
  • if (func == rb_f_notimplement)
  •    rb_define_notimplement_method_id(klass, id, NOEX_PROTECTED);
    
  • else
  •    rb_add_method(klass, id, NEW_CFUNC(func, argc), 
    

NOEX_PROTECTED);
}

void
rb_define_private_method(VALUE klass, const char *name, VALUE
(*func)(ANYARGS), int argc)
{

  • rb_add_method(klass, rb_intern(name), NEW_CFUNC(func, argc),
    NOEX_PRIVATE);
  • ID id = rb_intern(name);
  • if (func == rb_f_notimplement)
  •    rb_define_notimplement_method_id(klass, id, NOEX_PRIVATE);
    
  • else
  •    rb_add_method(klass, id, NEW_CFUNC(func, argc), NOEX_PRIVATE);
    

}

void
Index: process.c

— process.c (revision 23162)
+++ process.c (working copy)
@@ -2601,10 +2601,10 @@ rb_fork(int *status, int (chfunc)(void

  • fork doesn’t copy other threads.
    */

+#if defined(HAVE_FORK) && !defined(CANNOT_FORK_WITH_PTHREAD)
static VALUE
rb_f_fork(VALUE obj)
{
-#if defined(HAVE_FORK) && !defined(CANNOT_FORK_WITH_PTHREAD)
rb_pid_t pid;

 rb_secure(2);

@@ -2630,11 +2630,10 @@ rb_f_fork(VALUE obj)
default:
return PIDT2NUM(pid);
}
+}
#else

  • rb_notimplement();
    +#define rb_f_fork rb_f_notimplement
    #endif
    -}

/*

  • call-seq:
    Index: test/ruby/test_notimp.rb
    ===================================================================
    — test/ruby/test_notimp.rb (revision 0)
    +++ test/ruby/test_notimp.rb (revision 0)
    @@ -0,0 +1,64 @@
    +require ‘test/unit’
    +require ‘tmpdir’

+class TestNotImplement < Test::Unit::TestCase

  • def test_respond_to_fork
  • assert_includes(Process.methods, :fork)
  • if /linux/ =~ RUBY_PLATFORM
  •  assert_equal(true, Process.respond_to?(:fork))
    
  • end
  • end
  • def test_respond_to_lchmod
  • assert_includes(File.methods, :lchmod)
  • if /linux/ =~ RUBY_PLATFORM
  •  assert_equal(false, File.respond_to?(:lchmod))
    
  • end
  • if /freebsd/ =~ RUBY_PLATFORM
  •  assert_equal(true, File.respond_to?(:lchmod))
    
  • end
  • end
  • def test_call_fork
  • if Process.respond_to?(:fork)
  •  assert_nothing_raised {
    
  •    pid = fork {}
    
  •    Process.wait pid
    
  •  }
    
  • end
  • end
  • def test_call_lchmod
  • if File.respond_to?(:lchmod)
  •  Dir.mktmpdir {|d|
    
  •    f = "#{d}/f"
    
  •    g = "#{d}/g"
    
  •    File.open(f, "w") {}
    
  •    File.symlink f, g
    
  •    newmode = 0444
    
  •    File.lchmod newmode, "#{d}/g"
    
  •    snew = File.lstat(g)
    
  •    assert_equal(newmode, snew.mode & 0777)
    
  •  }
    
  • end
  • end
  • def test_method_inspect_fork
  • m = Process.method(:fork)
  • if Process.respond_to?(:fork)
  •  assert_not_match(/not-implemented/, m.inspect)
    
  • else
  •  assert_match(/not-implemented/, m.inspect)
    
  • end
  • end
  • def test_method_inspect_lchmod
  • m = File.method(:lchmod)
  • if File.respond_to?(:lchmod)
  •  assert_not_match(/not-implemented/, m.inspect)
    
  • else
  •  assert_match(/not-implemented/, m.inspect)
    
  • end
  • end

+end
Index: file.c

— file.c (revision 23162)
+++ file.c (working copy)
@@ -1926,12 +1926,7 @@ rb_file_s_lchmod(int argc, VALUE *argv)
return LONG2FIX(n);
}
#else
-static VALUE
-rb_file_s_lchmod(int argc, VALUE *argv)
-{

  • rb_notimplement();
  • return Qnil; /* not reached */
    -}
    +#define rb_file_s_lchmod rb_f_notimplement
    #endif

struct chown_args {


#20

In article removed_email_address@domain.invalid,
Tanaka A. removed_email_address@domain.invalid writes:

e$B$I$&$G$7$g$&$+e(B yugui e$B$5$se(B?

e$BH?1~$O$"$j$^$;$s$,!"F~$l$^$7$?!#e(B