From: Love U Ruby Date: 2013-02-18T06:26:46+09:00 Subject: Re: What is Ruby's default constructor? Stefano Crocco wrote in post #1097453: > > There was nothing "wrong" in your code before the 'begin'. > > What happened is that you redefined Object.new not to return a new > object, but > to return whatever > > p 'hi' > > returned (that is, the string 'hi'). This obviously messes up > everything: IRB > tried to create an instance of a certain class (let's call it X) by > using > X.new, which is the same as Object.new. However, this didn't return an > instance of X, but a string. Then IRB tried to call the #set_backtrace > method > on the returned object (which should have been an instance of X but was > instead a string). Since a string doesn't have a set_backtrace method, > you get > the error. As per your above explanation it seems and definitely an allocation to the memory has been made and only the reference has been lost. From my piece code - can it be possible to print also that memory address like "object_id" like the `p "hi" ` ? Thanks. -- Posted via http://www.ruby-forum.com/.