Like this?
private object compile_handler = class { mapping(string:mixed) get_default_module() { return ([ "this_program":0, "aggregate":aggregate, "aggregate_mapping":aggregate_mapping, "aggregate_multiset":aggregate_multiset ]); }
mixed resolv(string id, void|string fn, void|string ch) { error( "The symbol %O is forbidden.\n", id ); } }();
mixed eval(string what) { what -= "lambda"; what -= "class"; return compile_string( "mixed foo=" + what + ";", 0, compile_handler )()->foo; }
/ Martin Nilsson (Åskblod)
Previous text:
2003-02-11 15:03: Subject: sscanf %O
I actually aim for something that understands all non-expression constants that you can use in the Pike language, as well as the output of sprintf %O on constants that aren't objects, functions or programs.
The first almost gives the second. I believe it's only the possibility of recursive datatypes in the latter that has to expand the functionality.
/ Mirar