From 7320e53be18278a2121bbfc1f7911cd5b2fd411d Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 15 Nov 2004 01:52:45 +0000 Subject: [PATCH] * eval.c (Init_Proc): make proc as an alias to Proc.new. [ruby-dev:24848] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7270 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ eval.c | 13 +++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0261ffb6db..a3776a8e85 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Nov 15 08:58:55 2004 Yukihiro Matsumoto + + * eval.c (Init_Proc): make proc as an alias to Proc.new. + [ruby-dev:24848] + Mon Nov 15 00:46:03 2004 Yukihiro Matsumoto * eval.c (rb_yield_0): lambda{}.call(1) should raise exception. diff --git a/eval.c b/eval.c index 2f58a216dd..cf886db648 100644 --- a/eval.c +++ b/eval.c @@ -8060,6 +8060,13 @@ proc_s_new(argc, argv, klass) return block; } +/* + * call-seq: + * proc { |...| block } => a_proc + * + * Equivalent to Proc.new. + */ + VALUE rb_block_proc() { @@ -8075,7 +8082,6 @@ rb_f_lambda() /* * call-seq: - * proc { |...| block } => a_proc * lambda { |...| block } => a_proc * * Equivalent to Proc.new, except the resulting Proc objects @@ -8231,8 +8237,7 @@ proc_call(proc, args) * to take exactly n arguments, returns n. If the block has optional * arguments, return -n-1, where n is the number of mandatory * arguments. A proc with no argument declarations - * returns -1, as it can accept (and ignore) an arbitrary number of - * parameters. + * is handled like a block declaring || as its arguments. * * Proc.new {}.arity #=> 0 * Proc.new {||}.arity #=> 0 @@ -9294,7 +9299,7 @@ Init_Proc() rb_define_method(rb_cProc, "to_proc", proc_to_self, 0); rb_define_method(rb_cProc, "binding", proc_binding, 0); - rb_define_global_function("proc", proc_lambda, 0); + rb_define_global_function("proc", rb_block_proc, 0); rb_define_global_function("lambda", proc_lambda, 0); rb_cMethod = rb_define_class("Method", rb_cObject);