4 ms·
Self-modifying code (whether it's in Lisp, Java, or "other") could theoretically be useful, but there's a lot of "the devil's in the details" stuff to consider.
by mindcrime 4y ago
Self-modifying code (whether it's in Lisp, Java, or "other") could theoretically be useful, but there's a lot of "the devil's in the details" stuff to consider.
The first thing that comes to mind is the general idea that for any kind of continually improving system (the obvious analogy would be an evolutionary algorithm[0] of some sort) you need a "fitness function" that dictates whether or not the system is, in fact, improving. And defining the fitness function and the representation that maps from your code to the thing you're trying to improve, is often the hardest part.
FWIW, people have explored the intersection of evolutionary algorithms and code generation under the rubric of "Genetic Programming"[1][2][3]. This isn't necessarily the only (or best) such approach, but it's one that has been explored quite extensively and where there is a large body of literature to review. You might find some of that stuff interesting, vis-a-vis this overall topic.
[0]: https://en.wikipedia.org/wiki/Evolutionary_algorithm https://en.wikipedia.org/wiki/Evolutionary_algorithm
[1]: https://en.wikipedia.org/wiki/Genetic_programming https://en.wikipedia.org/wiki/Genetic_programming
[2]: https://geneticprogramming.com/ https://geneticprogramming.com/
[3]: http://www.genetic-programming.org/ http://www.genetic-programming.org/