Supports of indexed Members

Oct 25, 2007 at 1:00 PM
Is flee supports expression with indexed member? if yes, Can you show me an example of expression with indexed member access?

Is it possible to compile once an expression then use it with more than one instance of a class. For example :
Expression e = new Expression("sqrt(x)", typeof(MyType), options);
ExpressionEvaluator<double> evaluator = (ExpressionEvaluator<double>)e.Evaluator;
MyType owner1 = new MyType();
MyType owner2 = new MyType();
double result = evaluator(owner1);
double result = evaluator(owner2);
Coordinator
Oct 25, 2007 at 11:55 PM
>Is flee supports expression with indexed member? if yes, Can you show me an example of expression with indexed member access?

If you mean indexing arrays and collections then the answer is yes. I've added an example page that shows how to do this.

>Is it possible to compile once an expression then use it with more than one instance of a class.
Right now, no. I never really thought about being able to do that but it does seem pretty useful if you want to evaluate different sets of data. Unfortunately, this would require some code changes as the owner parameter to the delegate is fixed when the delegate is created.

Let me know if it is a critical requirement and I will see what I can do.

Thanks.
Oct 26, 2007 at 10:20 AM
Thank you for your fast reply.

Yes it is an important feature for me for performance reason

I have another problem, i would like to mix expression based on owner members and custom variables. In my case the owner is not a DynamicExpressionOwner but an instance of my application. Is it possible?
Here is an example of expression
DynamicExpressionOwner deo = new DynamicExpressionOwner();
deo.DefineVariable("MyCustomVariable", typeof(int));
deo.SetVariable("MyCustomVariable". 1);
Expression e = new Expression("MyMethod() = MyCustomVariable + 5", owner, options, deo);
Coordinator
Oct 27, 2007 at 11:13 PM
I think I've thought up of a way to implement your requests while at the same time making Flee more flexible. It will take me a couple of days as it requires major changes in the code.
Coordinator
Nov 6, 2007 at 1:14 AM
You can now change the instance of an expression's owner and mix owner members and variables in Flee-0.9.11.0