Coder Social home page Coder Social logo

miaplaza / expression-utils Goto Github PK

View Code? Open in Web Editor NEW
28.0 11.0 7.0 123 KB

Efficient Processing, Compilation, and Execution of Expression Trees at Runtime

License: MIT License

C# 100.00%
expression-tree linq-expressions linq expression-evaluator expression-comparer

expression-utils's People

Contributors

jsboige avatar khazuar avatar leo-labs avatar majorius1 avatar nifdee avatar saraedum avatar suzgupta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

expression-utils's Issues

PartialEvaluation is not strict about .Value

Trying to use PartialEvaluator.PartialEvalBody(where, ExpressionInterpreter.Instance); to remove the closure from u => u.UserID.Value > 1 where UserID is a ulong? produces the following error:

 ---> Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Operator '>' cannot be applied to operands of type 'int' and 'ulong'
   at CallSite.Target(Closure , CallSite , Object , Object )
   at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
   at MiaPlaza.ExpressionUtils.Evaluating.ExpressionInterpreter.ExpressionInterpretationVisitor.uncheckedConvert(Object original, Type target)
   at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
   at MiaPlaza.ExpressionUtils.Evaluating.ExpressionInterpreter.ExpressionInterpretationVisitor.GetResultFromUnary(UnaryExpression exp)
   at MiaPlaza.ExpressionUtils.ExpressionResultVisitor`1.DispatchVisitor.VisitUnary(UnaryExpression node)
   at System.Linq.Expressions.UnaryExpression.Accept(ExpressionVisitor visitor)
   at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
   at MiaPlaza.ExpressionUtils.ExpressionResultVisitor`1.GetResultFromExpression(Expression expression)
   at MiaPlaza.ExpressionUtils.Evaluating.ExpressionInterpreter.ExpressionInterpretationVisitor.GetResultFromExpression(Expression exp)
   at MiaPlaza.ExpressionUtils.Evaluating.ExpressionInterpreter.ExpressionInterpretationVisitor.GetResultFromUnary(UnaryExpression exp)
   at MiaPlaza.ExpressionUtils.ExpressionResultVisitor`1.DispatchVisitor.VisitUnary(UnaryExpression node)
   at System.Linq.Expressions.UnaryExpression.Accept(ExpressionVisitor visitor)
   at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
   at MiaPlaza.ExpressionUtils.ExpressionResultVisitor`1.GetResultFromExpression(Expression expression)
   at MiaPlaza.ExpressionUtils.Evaluating.ExpressionInterpreter.ExpressionInterpretationVisitor.GetResultFromExpression(Expression exp)
   at MiaPlaza.ExpressionUtils.Evaluating.ExpressionInterpreter.Interpret(Expression exp)
   --- End of inner exception stack trace ---
   at MiaPlaza.ExpressionUtils.Evaluating.ExpressionInterpreter.Interpret(Expression exp)
   at MiaPlaza.ExpressionUtils.Evaluating.ExpressionInterpreter.MiaPlaza.ExpressionUtils.Evaluating.IExpressionEvaluator.Evaluate(Expression unparametrizedExpression)
   at MiaPlaza.ExpressionUtils.PartialEvaluator.SubtreeEvaluator.Visit(Expression exp)).Invoke()```

Do not use Exceptions for program flow

E.g. in ParameterSubstituter exceptions are used for the program flow. This is in general considered bad practice and especially annoying when debugging since those exceptions will result in a context switch which is very expensive (slow).

New release

@Khazuar can you add more people on nuget to be maintainers of this so that we could upload updates there?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.