From: wys@... (Clemens Wyss) Date: 2001-02-06T16:10:03+09:00 Subject: [ruby-talk:10405] Re: Nested modules and classes? STRATEGY PATTERN? "Ben Tilly" wrote in : <> > class RecDescent > > # Try these rules in order > class Alt <> > > def parse (str, pos=0) <> > end > end > > # Match all rules in turn > class InOrder <> > > def parse (str, pos=0) <> > end > end > > > # And so on, more classes for each type of rule > > end > Why not have a base (strategy) class, say RecDescentParseStrategy, on the "same level" as RecDescent and let Alt and InOrder (and ...) be subclasses of RecDescentParseStartegy? At least the attr_accessor and the initialize method could be inherited. Clemens