Fantom doesn't really have an "eval". If you construct a fully correct source of an entire class you can compile into a script using sys::Env.compileScript. But I personally would write my own little parser for something like that (but then again I'm a compiler writer :-)
rhodes Wed 12 Sep 2012
What is the best way to evaluate a user-provided expression in the context of an object's field values?
For example, if the program has a list of
Student
objects...And a user provides a string predicate of fantom code...
What is the best way for me to filter the list using the string predicate they provide?
brian Wed 12 Sep 2012
Fantom doesn't really have an "eval". If you construct a fully correct source of an entire class you can compile into a script using
sys::Env.compileScript
. But I personally would write my own little parser for something like that (but then again I'm a compiler writer :-)mike Thu 13 Sep 2012
Busted link to Env -- here's the link:
http://fantom.org/doc/sys/Env.html#compileScript