Russell, some of your questions haven't been answered yet: > (...) > I had to make the classes > anonymous because I needed to include references to the classes in a > data structure (see subSections ) which tells the parser which section > types are valid in this section and what to do with them. I think you can use named classes just as well as anonymous classes: class HostService < Section ... def sub_sections( kind ) {'actions' => [nil, ActionList, @actions ], 'files' => [nil, CommaList, @files], ... end end (Note that I renamed the method. See http://wiki.rubygarden.org/Ruby/page/show/RubyStyleGuide) If you need to reference the classes before they are created, there are other possibilities besides class variables: you could use the names of the classes in the references and then call Module#const_get to get to the class object: def sub_sections( kind ) {'actions' => [nil, "ActionList", @actions ], 'files' => [nil, "CommaList", @files], ... end def class_for_name( name ) Object.const_get( name ) end Or you could pre-create the classes and re-open them later: class HostService < Section; end class ActionList < Section; end class CommaList < Section; end ... class HostService def sub_sections( kind ) {'actions' => [nil, ActionList, @actions ], 'files' => [nil, CommaList, @files], ... end end You could also add a convenience method to Section: class Section def self.define_sub_sections( *names ) names.each do |name| const_set( name, Class.new( Section ) ) end end define_sub_sections "HostService", "ActionList", "CommaList" class HostService ... end end > [ aside: someone asked why I wanted reference to scalar variable in my > previous post -- this is why. I needed to have a refernce to a variable > in that structure into which I could store the parsed class] I still don't understand the need to reference a variable. It seems all you want is to store a value in a variable, which you did with the class variables. > (...) > I have run into various problems in this project and have managed to > solve all of them but I am far from confident that my solution was the > best way of doing it. The use of anonymous classes is one example. See above. > I > wrote a generic text parser for this project and because Ruby does not > support multiple inheiritance I ended up passing an instance of the > parser as a parameter to all the methods -- I figured that since the > parser needed to maintain state that I could not make it a mixin... Modules in Ruby can maintain state. The only caveat is initializing the state. There are different ways to do it, and it has been discussed often on ruby-talk, but I don't have a reference. Regards, Pit