Personally, I don't see a problem with option 1.
For consistency (with entry-points) the named windows and usage thereof should, IMO, be defined thus:-
All,BACKGROUND:As Drools moves forward, we need to be able to declare several new structures, as well as make existing structures more robust for compile time analysis, error reporting and tooling support. For instance, as it is today, entry points are implicit declared by simply using them, i.e., if someone writes a pattern:X() from entry-point YThe engine will create entry-point Y implicitly. This is easy to use, but this makes it impossible for the engine to detect typos and report during compilation time. So, the idea is that we will allow the user to declare all the entry points he wants to use in his application and we will have a configuration option to enforce or not that list of declared entry points. If the configuration is set to enforce and the engine finds a rule that is using an entry point that is not part of the list, the engine can raise a compile time error point out the user's mistake. E.g., using pseudo code:declare entry-point X, Ydeclare entry-point ZDrools also needs a way to declare named windows for re-use on multiple rules. For instance, using pseudo code:declare window X@type( tumbling )@keep( last 10 )StockTick( symbol == "RHT" ) from entry-point YendAnd in the rule:rule ZwhenStockTick() from window:named Xthen...endQUESTION:As we can see above, we will need several new constructs in order to support features in our roadmap. We have the choice of making them all top level constructs, making the error recovery in the parser a lot more complicated, or we can re-use our declare construct to define these new structures as I presented in the pseudo-code above. Any pros/cons you can see in such approach?OPTION 1 (more verbose, but simpler and more stable):<epDeclaration> ::= declare entry-point <epName> [, <epName]*<windowDeclaration> ::= declare window <windowName> <restOfTheWindowDeclaration> end<typeDeclaration> ::= declare [type] <typeName> <restOfTheTypeDeclaration> endOPTION 2 (makes error recovery harder, but it is less verbose):<epDeclaration> ::= entry-point <epName> [, <epName]*<windowDeclaration> ::= window <windowName> <restOfTheWindowDeclaration> end<typeDeclaration> ::= declare <typeName> <restOfTheTypeDeclaration> endOPTION 3:<epDeclaration> ::= someOtherKeyword entry-point <epName> [, <epName]*<windowDeclaration> ::= someOtherKeyword window <windowName> <restOfTheWindowDeclaration> end<typeDeclaration> ::= declare [type] <typeName> <restOfTheTypeDeclaration> endEdson--
Edson Tirelli
JBoss Drools Core Development
JBoss by Red Hat @ www.jboss.com
_______________________________________________
rules-dev mailing list
rules-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev