Robert Klemme wrote: > "Jamis Buck" <jgb3 / email.byu.edu> schrieb im Newsbeitrag > news:412893BB.1050506 / email.byu.edu... > >>Either of those patterns would have worked as well. The state-based >>approach (which you demonstrated) is especially compelling. Although, I >>think I like the module-based approach because it eliminates the need >>for (1) extra state information (like the @state variable) and (2) >>condition testing (like the 'pre' method), which could become expensive. > > > It shares (2) with strategy/state pattern but with the added advantage of > saving a method call (the delegation). In fact, the longer I think about it > the more I like the module approach because it is very similar to the state > pattern but saves the overhead (you named it) - if only there would be a way > to unextend a module. That's really the biggest showstopper for using > mixins to implement state pattern. Darn... Hmm. What about some kind of "toggle!" method, which would dynamically re-alias a method between two different implementations? It's not as nice as mixins, but it gives the same effect, more or less... Or... can you dynamically create a new module with the desired functionality and extend your object with that? Hmm... >>"I use octal until I get to 8, and then I switch to decimal." > > > How do you get to "8" in octal? Is there a new variant "octal plus" that > has other digits than 0,1,2,3,4,5,6,7? :-) :) That's the idea. It was a quote of a coworker of mine explaining (facetiously) why he prefers the decimal base to the octal base. > > Kind regards > > robert - Jamis -- Jamis Buck jgb3 / email.byu.edu http://www.jamisbuck.org/jamis "I use octal until I get to 8, and then I switch to decimal."