NFun icon indicating copy to clipboard operation
NFun copied to clipboard

Expressions Evaluator for .NET

Results 39 NFun issues
Sort by recently updated
recently updated
newest added

Hello! ```c# Dictionary varMap = new() { ["sec"] = () => DateTime.Now.Second }; var calc = Funny.WithFunction("vars", (string name) => varMap[name]()).BuildForCalcConstant(); var result = calc.Calc("1 + vars('sec')"); Console.WriteLine(result); ``` These...

Help/Question

Under most cases when working with UInt16 and Int16 types seem to have a bug saying it didn't receive what it expected even though the exception actually says it did...

bug

``` out = [[1],true] ``` expected: out: any actual: Runtime error. Unable to cast from Real[] to Bool - [x] workaround: deny such casts for a while - [x] allow...

bug
Brutal
Tic

``` y = if (true) false else 12 ``` Expected: ``` y:any == false ``` Actual: ``` Error: TicIncompatibleAncestorSyntaxNodeException : Incompatible ancestor 2:[U8..Re]Re!=>3:Bo ```

invalid
Tic

``` var user = new User(age, name, cars); Funny.Serializer.Serialize(user); /* output * { * age = 25 * name = 'vasa' * cars = [ * {size = 1} *...

Definitely nice to have
Serialization

``` class Car{ public int Power {get;set;} public string Name {get;set;} public int Year {get;set;} } var result = Funny.Calc("{ power = 120 }");// Name and Year are not initalized...

Definitely nice to have
Brutal
Tic
Serialization

allow to write it like that: ``` {a}.{b}.{c}.{d} ``` where a,b,c,d is type of byte

Definitely nice to have
Syntax

As char is arithmetic type - it can be used in such an expressions: ``` word = [/'a'../'c'] #'abc' ips = [127.0.0.1.. 127.0.0.5] # [127.0.0.1, 127.0.0.2, 127.0.0.3, 127.0.0.4, 127.0.0.5] range(a,b)...

What if?
Syntax
Tic

``` [TestCase("'avatar'.reverse() > reverse('avatar') ", false)] [TestCase("('avatar'.reverse()) > reverse('avatar') ", false)] [TestCase("'avatar'.reverse() < 'avatar'", false)] public void ConstantEquation(string expr, bool expected) => expr.AssertReturns("out", expected); ``` Causes ``` System.InvalidCastException : Unable...

bug

Assume '' as multiline node (not in syntax, but for example of how it works under the hood) for example: ``` a = let: d = b**2 -4a*c { #value...

Definitely nice to have