From: Fuad Saud Date: 2013-10-15T23:39:58-03:00 Subject: [ruby-core:57895] Re: [ruby-trunk - Feature #9025] Clarify the error message when calling a method with the wrong number of arguments --525dfc7e_41b71efb_6094 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I like the =22expected=22 wording. Also, wouldn't help a little to print = the method name=3F May help to identify what's wrong faster. -- =20 =46uad Saud Sent with Sparrow (http://www.sparrowmailapp.com/=3Fsig) On Tuesday, October 15, 2013 at 11:34 PM, sawa (Tsuyoshi Sawada) wrote: > =20 > Issue =239025 has been updated by sawa (Tsuyoshi Sawada). > =20 > =20 > =22instead of=22 is even worse than =22for=22. It is ambiguous: =221 ar= gument was given instead of the expected 0=22 or =221 argument should be = given instead of 0 that was given=22. =22for=22 at least does not have th= at ambiguity. > ---------------------------------------- > =46eature =239025: Clarify the error message when calling a method with= the wrong number of arguments > https://bugs.ruby-lang.org/issues/9025=23change-42489 > =20 > Author: Nerian (Gonzalo Rodr=C3=ADguez) > Status: Open > Priority: Normal > Assignee: =20 > Category: =20 > Target version: =20 > =20 > =20 > Currently when calling a method with the wrong number of arguments we g= et a confusing error message: > =20 > ArgumentError: wrong number of arguments (1 for 0) > =20 > That means that the method was meant to accept 0 arguments, but 1 was p= rovided instead. This error message is confusing, and a large number of p= eople had to search for its meaning. =46or example =5B1=5D has 11000 view= s. > =20 > I propose that we change the error message to something whose meaning i= s obvious. Examples: > =20 > * ArgumentError: wrong number of arguments (expected: 1, provided: 0) > * ArgumentError: wrong number of arguments (1 instead of 0) > =20 > This ticket originated from this pull request: https://github.com/ruby/= ruby/pull/367 > =20 > =5B1=5D http://stackoverflow.com/questions/7537450/what-does-wrong-numb= er-of-arguments-1-for-0-mean-in-ruby > =20 > =20 > -- =20 > http://bugs.ruby-lang.org/ > =20 > =20 --525dfc7e_41b71efb_6094 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
I like the =22expected=22 wording. Also, wouldn't help a little to pr= int the method name=3F May help to identify what's wrong faster.

-- 
=46uad Saud
Sent with S= parrow

=20

On Tuesday, October 15= , 2013 at 11:34 PM, sawa (Tsuyoshi Sawada) wrote:


Issue =239025 has= been updated by sawa (Tsuyoshi Sawada).


=22instead of=22 is even worse than =22for=22. It is ambiguous: =22= 1 argument was given instead of the expected 0=22 or =221 argument should= be given instead of 0 that was given=22. =22for=22 at least does not hav= e that ambiguity.
----------------------------------------
=46eature =239025: Clarify the error message when calling a method = with the wrong number of arguments

Author: Nerian (Gonza= lo Rodr=C3=ADguez)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:


Currently when calling a method with the = wrong number of arguments we get a confusing error message:
ArgumentError: wrong number of arguments (1 for 0)
<= div>
That means that the method was meant to accept 0 argum= ents, but 1 was provided instead. This error message is confusing, and a = large number of people had to search for its meaning. =46or example =5B1=5D= has 11000 views.

I propose that we change the e= rror message to something whose meaning is obvious. Examples:
<= br>
* ArgumentError: wrong number of arguments (expected: 1, = provided: 0)
* ArgumentError: wrong number of arguments (1 ins= tead of 0)

This ticket originated from this pull= request: https://g= ithub.com/ruby/ruby/pull/367

<= div>

--
=20 =20 =20 =20
=20

--525dfc7e_41b71efb_6094--