[前][次][番号順一覧][スレッド一覧]

ruby-changes:21382

From: kosaki <ko1@a...>
Date: Sat, 8 Oct 2011 18:48:23 +0900 (JST)
Subject: [ruby-changes:21382] kosaki:r33431 (ruby_1_9_3): merge revision(s) 33391:

kosaki	2011-10-08 18:48:09 +0900 (Sat, 08 Oct 2011)

  New Revision: 33431

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33431

  Log:
    merge revision(s) 33391:
    
    * proc.c (proc_call):  Update documentation to match argument handling
      of proc/Proc.new/lambda/->()

  Modified files:
    branches/ruby_1_9_3/ChangeLog
    branches/ruby_1_9_3/proc.c

Index: ruby_1_9_3/ChangeLog
===================================================================
--- ruby_1_9_3/ChangeLog	(revision 33430)
+++ ruby_1_9_3/ChangeLog	(revision 33431)
@@ -1,3 +1,8 @@
+Sat Oct  8 05:45:28 2011  Eric Hodel  <drbrain@s...>
+
+	* proc.c (proc_call):  Update documentation to match argument handling
+	  of proc/Proc.new/lambda/->()
+
 Sat Oct  8 05:38:29 2011  Eric Hodel  <drbrain@s...>
 
 	* proc.c (proc_call):  Fix documentation of Proc#call vs Proc#===.
Index: ruby_1_9_3/proc.c
===================================================================
--- ruby_1_9_3/proc.c	(revision 33430)
+++ ruby_1_9_3/proc.c	(revision 33431)
@@ -518,10 +518,10 @@
  *  to an array).  Note that prc.() invokes prc.call() with the parameters
  *  given.  It's a syntax sugar to hide "call".
  *
- *  For procs created using <code>Kernel.proc</code> an error is generated
- *  if the wrong number of parameters are passed to a proc with multiple
- *  parameters. For procs created using <code>Proc.new</code>, extra
- *  parameters are silently discarded.
+ *  For procs created using <code>lambda</code> or <code>->()</code> an error
+ *  is generated if the wrong number of parameters are passed to a Proc with
+ *  multiple parameters.  For procs created using <code>Proc.new</code> or
+ *  <code>Kernel.proc</code>, extra parameters are silently discarded.
  *
  *  Returns the value of the last expression evaluated in the block. See
  *  also <code>Proc#yield</code>.
@@ -529,14 +529,15 @@
  *     a_proc = Proc.new {|a, *b| b.collect {|i| i*a }}
  *     a_proc.call(9, 1, 2, 3)   #=> [9, 18, 27]
  *     a_proc[9, 1, 2, 3]        #=> [9, 18, 27]
- *     a_proc = Proc.new {|a,b| a}
+ *     a_proc = lambda {|a,b| a}
  *     a_proc.call(1,2,3)
  *
  *  <em>produces:</em>
  *
- *     prog.rb:5: wrong number of arguments (3 for 2) (ArgumentError)
- *     	from prog.rb:4:in `call'
- *     	from prog.rb:5
+ *     prog.rb:4:in `block in <main>': wrong number of arguments (3 for 2) (ArgumentError)
+ *     	from prog.rb:5:in `call'
+ *     	from prog.rb:5:in `<main>'
+ *
  */
 
 static VALUE

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]