From: John Joyce Date: 2007-07-09T01:24:43+09:00 Subject: Re: Polymorphic Code On Jul 8, 2007, at 10:41 AM, Ari Brown wrote: > > On Jul 7, 2007, at 11:21 PM, Sharon Phillips wrote: >> Do you mean something like this (example below)? >> What you should be aware of is that Ruby doesn't require you to >> cast objects to a particular type in order to call a method. You >> may have a number of objects of completely different classes in >> your collection, and as long as they all respond to the method >> you're interested in then you can iterate through and call that >> method (duck typing). This makes interfaces redundant and is a >> fantastically useful feature. > > > Not quite. What I mean is is there a way to make Ruby actually > modify the code? > > ~ Ari > English is like a pseudo-random number generator - there are a > bajillion rules to it, but nobody cares. > > Yes and no. Certainly, you could write code that dynamically writes/ configures other code files as things occur but it's kind of pointless in most cases. The same effect can be achieved through branching and looping. Perhaps you should read some about A.I. Arificial Intelligence and fuzzy decision making is kind of another aspect of program control. Branching, looping, and LEARNING. Machine learning exists, but the kind where we train it by showing it examples that it sees as patterns of yes or no and builds a heuristic. Making a machine learn on its own through independent discovery is something different.