* 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
This commit is contained in:
matz 2004-11-15 01:52:45 +00:00
parent 9d4144af09
commit 7320e53be1
2 changed files with 14 additions and 4 deletions

View File

@ -1,3 +1,8 @@
Mon Nov 15 08:58:55 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (Init_Proc): make proc as an alias to Proc.new.
[ruby-dev:24848]
Mon Nov 15 00:46:03 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_yield_0): lambda{}.call(1) should raise exception.

13
eval.c
View File

@ -8060,6 +8060,13 @@ proc_s_new(argc, argv, klass)
return block;
}
/*
* call-seq:
* proc { |...| block } => a_proc
*
* Equivalent to <code>Proc.new</code>.
*/
VALUE
rb_block_proc()
{
@ -8075,7 +8082,6 @@ rb_f_lambda()
/*
* call-seq:
* proc { |...| block } => a_proc
* lambda { |...| block } => a_proc
*
* Equivalent to <code>Proc.new</code>, 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 <code>proc</code> with no argument declarations
* returns -1, as it can accept (and ignore) an arbitrary number of
* parameters.
* is handled like a block declaring <code>||</code> 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);