From: Florian Gilcher Date: 2012-02-21T19:25:14+09:00 Subject: Re: Difference between 1.9.2 and 1.9.3 --Apple-Mail-59--674607076 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 On Feb 21, 2012, at 11:00 AM, Peter Vandenabeele wrote: > On Tue, Feb 21, 2012 at 9:40 AM, Bartosz Dziewo=C5=84ski = wrote: > That's because super with parentheses passes the same args your method >=20 > I assume this was a typo, meaning "without" parentheses. > =20 > was called with (like Dave said), and default Object#initialize method > takes no arguments. >=20 > But that's interesting. You might want to mention it at Ruby's bug > tracker: bugs.ruby-lang.org - maybe the default initializer should > take any number of args and just discard them. >=20 > I think that is not a good idea. With the current implementation, it > is still possible to add optional arguments later. If a method (e.g. > initialize) would accept any number of arguments and just discard > them, then later on, adding 1 or more optional arguments in the > definition would suddenly cause bugs as these initially discarded > arguments would then interpreted as a real, optional argument. >=20 > Just write `super()` when calling the higher up initializer. >=20 > HTH, >=20 > Peter I didn't know this actually made it into 1.9.2, but for a while, the = default initialize method took a variable number of args and just dropped them. = It was reverted a while back. Best regards, Florian --Apple-Mail-59--674607076 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
On Tue, Feb 21, 2012 at 9:40 = AM, Bartosz Dziewo=C5=84ski <matma.rex@gmail.com> = wrote:
That's because super with parentheses passes the same args your = method

I assume this was a typo, meaning = "without" parentheses.
 
was called with (like Dave said), and default Object#initialize = method
takes no arguments.

But that's interesting. You might want to mention it at Ruby's bug
tracker: bugs.ruby-lang.org - maybe the default initializer = should
take any number of args and just discard = them.

I think that is not a good idea. With the = current implementation, it
is still possible to add optional = arguments later. If a method (e.g.
initialize) would accept any = number of arguments and just discard
them, then later on, adding 1 or more optional arguments in = the
definition would suddenly cause bugs as these initially = discarded
arguments would then interpreted as a real, optional = argument.

Just write `super()` when calling the higher up = initializer.

HTH,

Peter

I didn't = know this actually made it into 1.9.2, but for a while, the = default
initialize method took a variable number of args and = just dropped them. It
was reverted a while = back.

Best = regards,
Florian

= --Apple-Mail-59--674607076--