Thank you for your help,
This question is part of a larger something I’ve been curious about for
a while. I, essentially, want to make a set of rules and basic methods,
then develop a program that can, when given input, determine what
methods to apply and apply them; and, depending on the rules, if it can
generate a new method that would give a more desirable outcome.
Basically, I want to make a program that will have the ability to
reprogram/build on it self.
Robert K. wrote:
On 09.01.2009 18:48, Erick Star wrote:
You can leave out method d and use send() directly, i.e.
a = A.new
Then use thing.d(a) with thing an instance of A?
Basically, given a long list of methods belonging to a class, if you
wanted ruby to apply methods based on the state of the program, how
would you set it up besides doing:
State pattern comes to mind.
There are a number of options for modeling this besides of state
pattern. Generally any OO approach exploits overriding of methods, i.e.
you have several classes which share a method with identical signature
but different behavior.