From: Warren Ferguson Date: 2010-08-08T08:51:54+09:00 Subject: Re: question about sub-class of array Aaron D. Gifford wrote: > Q: Is there any benefit to storing a copy of self in @a? Is there any > drawback to eliminating the initialize definition in the child class > and replacing the "@a" in the to_s method with "self"? What am I > missing? > > Wondering, > Aaron out. No, there isn't, my bad. I added the initialize method because I thought it might be the source of the original problem. Taking it out and using self instead works fine. I'm stil mystified why substituting the expression for v into Bitvector.new(v) fails. Is it because Ruby optimizes that complex expression by realizing the expression is of class Array and Bitvector is a subclass of array? -- Posted via http://www.ruby-forum.com/.