Hi Jeff,
I'm going to assume that you have a way of determing the types of the
input variables a, b, and c.
Yes, all variables are strongly typed - they are loaded from a database.
You can use the IronPython parser classes to convert the
expressions into an AST; the tricky part is doing the actual
inference.
When the DLR executes the expression's compiled code for the first time,
it is compiled into assembly code. Repeated calls of the expression with
the same input types will reuse the assembly code. So from this assembly
code the type could be infered... But I have no glue how to get this
information...
Can you give some examples of expressions you need to infer?
arithmetic operations: a + b / c
functions: sqrt(a)
These are mostly straightforward - Python's type conversion rules for
arithmetic operators are well-defined. Presumably, sqrt is defined in
your code (or is just Math.sqrt) - thus the return type is the same as
the input type.
Clearly this could all be implemented (type conversion rules, find
function return types and arguments by reflection, ...), but the DLR is
already doing it.
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com