19 Oct
2006
19 Oct
'06
11:11 p.m.
"Arnaldur Gylfason"
Let's say I have to parse "(_1 + _2)*_1" and "(_1/_2)*_1". I only get these command strings at runtime so I don't know the expressions at compile time. I have to parse the strings and gradually build the lambda expression.
I think you are trying to achieve an impossible thing. Compiler is the one to create the types. You can control the compiler, so that it creates the types based on a non-trivial algorithm, but all of this should be done at compile time, and based on compile-time input: types and constants hardcoded into your program. By the runtime it's over -- you can't create the types based on the runtime string value. The typeof solves the problem because it works at compile time. Regards, Arkadiy