I can understand the allure of mutating and evaling code for evolutionary programming, but I think it's fundamentally not the right way to go. You probably want to write some kind of simple, high-performance interpreter for a custom data structure, which is essentially what Steven is suggesting. Otherwise you're going to really spend a lot of time in eval.
On Fri, Aug 12, 2016 at 3:12 PM, Steven G. Johnson <[email protected]> wrote: > > > On Friday, August 12, 2016 at 1:35:11 PM UTC-4, Garrett Jenkinson wrote: >> >> I have written a bit of a hack of a library for evolutionary computation, >> where I continually evolve a system of "cells" that have different reaction >> networks governed by ordinary differential equations. Basically, when I >> need to solve the ODE for a cell, I have it generate a string that after >> parse/eval'ing is a function to be passed onto ode23s in ODE.jl for >> solving. >> > > Why do you need to use parse/eval at all? Why can't you just write a > function that implements your ODE given a data structure representing the > reaction network? > > As a rule of thumb, if you are doing runtime parse/eval, you are usually > making a mistake. (As opposed to compile-time parse/eval, e.g. when a > module is loaded; that kind of metaprogramming is quite useful and natural > in Julia. The main exception where runtime parse/eval is appropriate is if > you are presenting a user interface where a human can input code > expressions to modify your runtime behavior.) >
