ruby-changes:1752
From: ko1@a...
Date: 24 Aug 2007 17:16:04 +0900
Subject: [ruby-changes:1752] matz - Ruby:r13243 (trunk): * eval.c (rb_f_send_bang): abandon the name funcall for private
matz 2007-08-24 17:15:37 +0900 (Fri, 24 Aug 2007) New Revision: 13243 Modified files: trunk/ChangeLog trunk/bootstraptest/test_method.rb trunk/eval.c trunk/insnhelper.ci trunk/lib/delegate.rb trunk/lib/matrix.rb trunk/lib/monitor.rb trunk/version.h Log: * eval.c (rb_f_send_bang): abandon the name funcall for private aware method call. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/insnhelper.ci?r1=13243&r2=13242 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/version.h?r1=13243&r2=13242 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/monitor.rb?r1=13243&r2=13242 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/delegate.rb?r1=13243&r2=13242 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=13243&r2=13242 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/bootstraptest/test_method.rb?r1=13243&r2=13242 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/eval.c?r1=13243&r2=13242 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/matrix.rb?r1=13243&r2=13242 Index: ChangeLog =================================================================== --- ChangeLog (revision 13242) +++ ChangeLog (revision 13243) @@ -1,3 +1,8 @@ +Fri Aug 24 17:06:56 2007 Yukihiro Matsumoto <matz@r...> + + * eval.c (rb_f_send_bang): abandon the name funcall for private + aware method call. + Thu Aug 23 20:31:31 2007 Koichi Sasada <ko1@a...> * compile.c: optimize simple massign. Index: bootstraptest/test_method.rb =================================================================== --- bootstraptest/test_method.rb (revision 13242) +++ bootstraptest/test_method.rb (revision 13243) @@ -316,7 +316,7 @@ assert_equal '1', %q( class C; def m() 7 end; private :m end begin C.new.send(:m); rescue NoMethodError; 1 end ) assert_equal '1', %q( class C; def m() 1 end; private :m end - C.new.funcall(:m) ) + C.new.send!(:m) ) # with block assert_equal '[[:ok1, :foo], [:ok2, :foo, :bar]]', @@ -867,7 +867,7 @@ end end - alias funcall send unless defined? funcall + alias send! send unless defined? send! c1 = c2 = nil @@ -899,8 +899,8 @@ test{o2.mm} test{o1.send :m} test{o2.send :mm} - test{o1.funcall :m} - test{o2.funcall :mm} + test{o1.send! :m} + test{o2.send! :mm} test{o1.method(:m).call} test{o2.method(:mm).call} $ans Index: lib/monitor.rb =================================================================== --- lib/monitor.rb (revision 13242) +++ lib/monitor.rb (revision 13243) @@ -91,13 +91,13 @@ if timeout raise NotImplementedError, "timeout is not implemented yet" end - @monitor.funcall(:mon_check_owner) - count = @monitor.funcall(:mon_exit_for_cond) + @monitor.send!(:mon_check_owner) + count = @monitor.send!(:mon_exit_for_cond) begin @cond.wait(@monitor.instance_variable_get("@mon_mutex")) return true ensure - @monitor.funcall(:mon_enter_for_cond, count) + @monitor.send!(:mon_enter_for_cond, count) end end @@ -114,12 +114,12 @@ end def signal - @monitor.funcall(:mon_check_owner) + @monitor.send!(:mon_check_owner) @cond.signal end def broadcast - @monitor.funcall(:mon_check_owner) + @monitor.send!(:mon_check_owner) @cond.broadcast end @@ -137,7 +137,7 @@ def self.extend_object(obj) super(obj) - obj.funcall(:mon_initialize) + obj.send!(:mon_initialize) end # Index: lib/delegate.rb =================================================================== --- lib/delegate.rb (revision 13242) +++ lib/delegate.rb (revision 13243) @@ -115,7 +115,7 @@ # implementation, see SimpleDelegator. # class Delegator - preserved = [:__id__, :object_id, :__send__, :__send, :__send!, :respond_to?, :send, :funcall] + preserved = [:__id__, :object_id, :__send__, :__send, :__send!, :respond_to?, :send, :send!] instance_methods.each do |m| next if preserved.include?(m) undef_method m @@ -262,7 +262,7 @@ klass = Class.new methods = superclass.public_instance_methods(true) methods -= [ - :__id__, :object_id, :__send__, :__send, :__send!, :respond_to?, :send, :funcall, + :__id__, :object_id, :__send__, :__send, :__send!, :respond_to?, :send, :send!, :==, :equal?, :initialize, :method_missing, :__getobj__, :__setobj__, :clone, :dup, :marshal_dump, :marshal_load, ] Index: lib/matrix.rb =================================================================== --- lib/matrix.rb (revision 13242) +++ lib/matrix.rb (revision 13243) @@ -246,7 +246,7 @@ # use to general users. # def initialize(init_method, *argv) - self.funcall(init_method, *argv) + self.send!(init_method, *argv) end def init_rows(rows, copy) Index: eval.c =================================================================== --- eval.c (revision 13242) +++ eval.c (revision 13243) @@ -1437,7 +1437,7 @@ } static VALUE -send_funcall(int argc, VALUE *argv, VALUE recv, int scope) +send_internal(int argc, VALUE *argv, VALUE recv, int scope) { VALUE vid; @@ -1479,26 +1479,26 @@ scope = NOEX_NOSUPER | NOEX_PRIVATE; } - return send_funcall(argc, argv, recv, scope); + return send_internal(argc, argv, recv, scope); } /* * call-seq: - * obj.funcall(symbol [, args...]) => obj - * obj.__send!(symbol [, args...]) => obj + * obj.send!(symbol [, args...]) => obj + * obj.__send!(symbol [, args...]) => obj * * Invokes the method identified by _symbol_, passing it any - * arguments specified. Unlike send, which calls private methods only - * when it is invoked in function call style, funcall always aware of + * arguments specified. Unlike send, which calls public methods only + * when it is invoked in function call style, send! always aware of * private methods. * - * 1.funcall(:puts, "hello") # prints "foo" + * 1.send!(:puts, "hello") # prints "foo" */ VALUE -rb_f_funcall(int argc, VALUE *argv, VALUE recv) +rb_f_send_bang(int argc, VALUE *argv, VALUE recv) { - return send_funcall(argc, argv, recv, NOEX_NOSUPER | NOEX_PRIVATE); + return send_internal(argc, argv, recv, NOEX_NOSUPER | NOEX_PRIVATE); } VALUE @@ -2730,8 +2730,8 @@ rb_define_method(rb_cBasicObject, "send", rb_f_send, -1); rb_define_method(rb_cBasicObject, "__send__", rb_f_send, -1); rb_define_method(rb_cBasicObject, "__send", rb_f_send, -1); - rb_define_method(rb_cBasicObject, "funcall", rb_f_funcall, -1); - rb_define_method(rb_cBasicObject, "__send!", rb_f_funcall, -1); + rb_define_method(rb_cBasicObject, "send!", rb_f_send_bang, -1); + rb_define_method(rb_cBasicObject, "__send!", rb_f_send_bang, -1); rb_define_method(rb_mKernel, "instance_eval", rb_obj_instance_eval, -1); rb_define_method(rb_mKernel, "instance_exec", rb_obj_instance_exec, -1); Index: version.h =================================================================== --- version.h (revision 13242) +++ version.h (revision 13243) @@ -1,7 +1,7 @@ #define RUBY_VERSION "1.9.0" -#define RUBY_RELEASE_DATE "2007-08-23" +#define RUBY_RELEASE_DATE "2007-08-24" #define RUBY_VERSION_CODE 190 -#define RUBY_RELEASE_CODE 20070823 +#define RUBY_RELEASE_CODE 20070824 #define RUBY_PATCHLEVEL 0 #define RUBY_VERSION_MAJOR 1 @@ -9,7 +9,7 @@ #define RUBY_VERSION_TEENY 0 #define RUBY_RELEASE_YEAR 2007 #define RUBY_RELEASE_MONTH 8 -#define RUBY_RELEASE_DAY 23 +#define RUBY_RELEASE_DAY 24 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[]; Index: insnhelper.ci =================================================================== --- insnhelper.ci (revision 13242) +++ insnhelper.ci (revision 13243) @@ -580,10 +580,10 @@ { if (*mn && nd_type((*mn)->nd_body) == NODE_CFUNC) { NODE *node = (*mn)->nd_body; - extern VALUE rb_f_funcall(int argc, VALUE *argv, VALUE recv); + extern VALUE rb_f_send_bang(int argc, VALUE *argv, VALUE recv); extern VALUE rb_f_send(int argc, VALUE *argv, VALUE recv); - if (node->nd_cfnc == rb_f_funcall || node->nd_cfnc == rb_f_send) { + if (node->nd_cfnc == rb_f_send_bang || node->nd_cfnc == rb_f_send) { int i = *num - 1; VALUE sym = TOPN(i); *id = SYMBOL_P(sym) ? SYM2ID(sym) : rb_to_id(sym); @@ -598,7 +598,7 @@ DEC_SP(1); } - if (node->nd_cfnc == rb_f_funcall) { + if (node->nd_cfnc == rb_f_send_bang) { *flag |= VM_CALL_FCALL_BIT; } } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml