From: Soichi Ishida Date: 2012-07-05T19:21:48+09:00 Subject: Re: self.clone.replace(super)? > > These super class methods will return Array instances but the author > wanted to make sure they return instances of RegexAlternation in class > RegexAlternation. > > Few remarks: "self." is superfluous. "clone" should be replaced by > "dup" because otherwise methods will break on a frozen instance. > Thanks. It makes sense now. > Generally it's a bad idea IMHO to inherit core classes. For example, > someone testing for Array will receive true and might be tempted to do > things with the instance which do not make sense for a > RegexAlternation. It's better to create a completely unrelated class > which can still implement the same API (or part of it) as the wrapped > class if necessary. Huh, thanks for the tip. I will be careful. soichi -- Posted via http://www.ruby-forum.com/.