gitgabrio commented on PR #5746:
URL: 
https://github.com/apache/incubator-kie-drools/pull/5746#issuecomment-1966233425

   Thanks @mariofusco !
   
   The caveat I found is that in the following expression
   
   `$p : Person($booleanVariable: (name != null ? true : false))` 
   
   the 
   
   `$booleanVariable: (name != null ? true : false)` 
   
   part is actually an _**assignment**_, so semantically the same as
   
   `$p : Person($anotherVariable: ("name"+"somethingelse"))`
   
   so, changing the behavior base on the type of the variable, seems 
unconsistent to me.
   
   In that very example, the rule should be evaluated only when 
   `name != null`, and only in that case the `$booleanVariable` should be 
populated.
   The concept applies beside that simple example, of course, whenever a 
boolean property is assigned _on the fly_ in the `when` clause while, actually, 
this should happen in the `then`:
   if the rule is executed based on the `predicate` itself, then the variable 
will be populated (in that context, for me the `name != null ? true : false` is 
the predicate, and the `$booleanVariable` is the result of it)
   
   AFAIK, this should be the correct syntax
   
   ```
   global Boolean booleanVariable
   rule \"r1\"
   when 
       $p : Person(name != null);
   then
      booleanVariable = true;
      System.out.println(booleanVariable); 
      System.out.println($p); 
      booleanListGlobal.add(booleanVariable); 
   end
   ```
   
   I have the impression that we are looking for a modification around a wrong 
usage of the language, putting a `consequence` semantic inside an `evaluating` 
one. 
   I'm not the responsible of drl language, but this seems strange to me, from 
a logical point of view.
   
   
   
   
    
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to