Language Integrated Definition of Rules #5900
Replies: 3 comments 16 replies
-
To me, it sounds a bit like F# computation expressions, where you can write down an algorithm using normal constructs, like But there is another aspect to it, in those examples of use case areas you give (rules engine, automata, etc.), that rules are, somehow stored as data (an abstract syntax tree), and those can be modelled as data structures, as exemplified in Roslyn codebase, and C# is gearing towards enabling expressivity with OO & value initialisation constructs, so, a C# developer is never too far to sketch own DSL baked in data as C# OO constructs, and an interpreter for it. @AdamSobieski could you expand on code samples that would show as "LINQ for rules for C# v++", that may help narrow down a bit, implication on C# language itself. Thanks! |
Beta Was this translation helpful? Give feedback.
-
I'm not really understanding waht is being asked for at a language level here. What syntactic and semantic changes are you interested in? And how do you envision them being compiled/encoded at a metadata/il level? Thanks! |
Beta Was this translation helpful? Give feedback.
-
@AdamSobieski it seems that you have given rule engines some thought and that you have used them. I have always wondered what the use case is. It seems that you can write the same logic simpler in normal C#. Would you care to explain? I'd be interested. For example, when we take your code snippet:
How would this rule definition be used? |
Beta Was this translation helpful? Give feedback.
-
I would like to propose a C# language idea: the language integrated definition of various kinds of rules.
Rule engine software appear to contain domain-specific languages with which to define interoperable rules. NRules contains the Fluent Rules DSL, for example, and the Microsoft Rules Engine utilizes a text version of lambda expressions.
What do you think about extending the C# language to simplify the definition of various kinds of rules? Might C# language designers be able to generalize over kinds of rules and their definitions as they did with relational algebra for LINQ?
New language features could better equip software engineers for scenarios including business rules engines, automated decision support, machine learning, and automated decision-making.
What do you think?
Beta Was this translation helpful? Give feedback.
All reactions