It would be very convenient to add a Scope support into Interpreter. Consider the following snippet:
record Person(string Name, string Gender, int Age);
var interpreter = new Interpreter();
// this is a proposed Scope feature
interpreter.UseScope<Person>();
var person = new Person("Ulrich", "Male", 30);
var lambda = interpreter.Parse("Gender == \"Male\" && Age >= 30");
Assert.True(lambda.Invoke(person));
So it looks like a this reference that is implicitly passed when calling class methods.
Although I can pass a person object itself as a variables - this will make the expression more complex i.e. "person.Gender == \"Male\" && person.Age >= 30" what is less convenient and not concise.
It would be very convenient to add a Scope support into Interpreter. Consider the following snippet:
So it looks like a
thisreference that is implicitly passed when calling class methods.Although I can pass a person object itself as a variables - this will make the expression more complex i.e.
"person.Gender == \"Male\" && person.Age >= 30"what is less convenient and not concise.