Skip to content

Interpreter Scope identifier support #232

@ealeykin

Description

@ealeykin

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions