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.)
