Giter Club home page Giter Club logo

ncalc2's People

Contributors

pitermarx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ncalc2's Issues

Circular reference causes stack overflow

As discussed in pitermarx/NCalc-Edge#14, when using circular references, the Evaluate method leads to a StackOverflowException (which is not catchable).
For user written expressions, this is a blocking problem.
For example :

NCalc.Expression exp = new NCalc.Expression("RefCroise1");
exp.Parameters["RefCroise1"] = new NCalc.Expression("RefCroise2 * 5");
exp.Parameters["RefCroise2"] = new NCalc.Expression("RefCroise1 * 12");
object result = exp.Evaluate(); // Causes stack overflow

.hasErrors() neither detects it.

I think this is a major error to be detected, as this is crashing the program.

Nota : I did not check how it is in NCalc2 but as @pitermarx asked, I'm creating the PR here.
Thanks.

Int overflow

var maxInt = Int32.MaxValue;
var overflow = new Expression(maxInt + "+1").Evaluate();

The engine rightly assumes an integer number as an Int32 but this leads to overflow.
Investigate a way to have explicit cast to long.

Will this become a Nuget package?

I'm looking at submitting a pull request for some small improvements with larger data calculations. Would this repo or your NCalc-Edge have a higher chance of a newer Nuget package being release?

TraceInformation

Hi

Is there a way to disable TraceInformation logging? We are using logging in our app and the logs are getting spammed by NCalc logs, for example Trace.TraceInformation in Expression.cs.

Thanks

Allow type mismatches to resolve to "false", or provide hook to customize comparison behavior

I'm evaluating expressions with some highly dynamic, unknown-at-runtime data. Say integer values are passed for x and y in the following expression:

x = 5 or y = 'foo'

Ideally, if x is 5 I'd like this to evaluate to true. But in the case where y is an integer, the entire expression fails with a FormatException. If y is null, it fails with a NullReferenceException. Both are thrown from EvaluationVisitor.CompareUsingMostPreciseType.

I'm not sure if evaluating to false in those cases instead throwing exceptions is necessarily more correct. Maybe a better approach would be to provide hooks into those comparisons to allow that behavior to be customized.

Generally speaking, would you consider this project active? I searched hard for a good .NET expression parsing engine and none seem to be very active from what I've seen. (I'm actually using the original NCalc, but your forks are much newer so I figured you might be more open to further development.) If a new fork would be the way to go, or me taking over this one, I would gladly entertain the idea. Our company is investing fairly heavily in a new rules engine of which this could be an important component. I'd be glad to keep it alive and moving forward. Alternatively, if you'd consider a pull request, I could do that too.

Thanks!

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.