warning: redefining Object#initialize may cause infinite loop

T

Trans

irb(main):001:1class Object
irb(main):002:1> alias :init :initialize
irb(main):003:1> def initialize( *args, &blk )
irb(main):004:2> init( *args, &blk )
irb(main):005:2> end
irb(main):006:1> end
(irb):3: warning: redefining Object#initialize may cause infinite loop

Is this warning really neccessary?

Thanks,
T.
 
D

Daniel Berger

Trans said:
irb(main):001:1class Object
irb(main):002:1> alias :init :initialize
irb(main):003:1> def initialize( *args, &blk )
irb(main):004:2> init( *args, &blk )
irb(main):005:2> end
irb(main):006:1> end
(irb):3: warning: redefining Object#initialize may cause infinite loop

Is this warning really neccessary?

Thanks,
T.

No, and I'd like to reiterate my idea for structured warnings so that
we can wrap and disable them as we like. :)

- Dan
 
Y

Yukihiro Matsumoto

Hi,

In message "Re: warning: redefining Object#initialize may cause infinite loop"

|irb(main):001:1class Object
|irb(main):002:1> alias :init :initialize
|irb(main):003:1> def initialize( *args, &blk )
|irb(main):004:2> init( *args, &blk )
|irb(main):005:2> end
|irb(main):006:1> end
|(irb):3: warning: redefining Object#initialize may cause infinite loop
|
|Is this warning really neccessary?

Object#initialize is too broad. If you allocate anything that calls
Object#initialize it would turned out to be infinite loop which is
definitely not expected at all. I was surprised when I met it.

matz.
 
D

dblack

Hi --

Hi,

In message "Re: warning: redefining Object#initialize may cause infinite loop"

|irb(main):001:1class Object
|irb(main):002:1> alias :init :initialize
|irb(main):003:1> def initialize( *args, &blk )
|irb(main):004:2> init( *args, &blk )
|irb(main):005:2> end
|irb(main):006:1> end
|(irb):3: warning: redefining Object#initialize may cause infinite loop
|
|Is this warning really neccessary?

Object#initialize is too broad. If you allocate anything that calls
Object#initialize it would turned out to be infinite loop which is
definitely not expected at all. I was surprised when I met it.

That doesn't matter: POLS only means Matz's surprise. Oh, wait....
:)))


David

--
David A. Black | (e-mail address removed)
Author of "Ruby for Rails" [1] | Ruby/Rails training & consultancy [3]
DABlog (DAB's Weblog) [2] | Co-director, Ruby Central, Inc. [4]
[1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com
[2] http://dablog.rubypal.com | [4] http://www.rubycentral.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top