I've done some programs that evolve data-structures (morphology) in a manner similar to Richard Dawkin's 'Blind Watchmaker' program.

Writing actionscript programs that evolve actionscript code is cumbersome, because there is no easy way to execute the code that is output by these programs - there is no general purpose 'eval' function in actionscript, as there is in some interpreted languages, such as Perl and Forth and Lisp. Lisp is a particularly good language for doing this kind of thing.

Interestingly, some viruses and worms use a similar technique to what you suggest to modify themselves as they spread across the internet - making them very difficult for virus-software to catch.