From: Austin Ziegler Date: 2005-07-08T07:35:12+09:00 Subject: Re: Inheriting Array and slice() behaviour On 7/7/05, William Morgan wrote: > Excerpts from Pit Capitain's mail of 7 Jul 2005 (EDT): > > The LSP has been mentioned before in this thread. According to that > > principle, if someone creates a subclass of Array, you should be able > > to use the subclass like the original Array class. Array has a well > > defined #initialize method that can take zero arguments. So should the > > subclass, otherwise you're breaking the LSP. In other words, it's > > perfectly legal to call self.class.new in #slice. If Expression can't > > provide an #initialize method without arguments, it shouldn't be a > > subclass of Array. > So you're suggesting that #initialize be called (automatically) by > Array#slice, with no arguments? And, presumably, an ArgumentError raised > if it has required arguments? No, from a design level, Expression isn't an Array if it doesn't accept #initialize with no arguments. -austin -- Austin Ziegler * halostatue@gmail.com * Alternate: austin@halostatue.ca