[jboss-jira] [JBoss JIRA] Commented: (JBRULES-1607) or with pattern binding doesn't work

Edson Tirelli (JIRA) jira-events at lists.jboss.org
Wed Apr 8 21:17:22 EDT 2009


    [ https://jira.jboss.org/jira/browse/JBRULES-1607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12461357#action_12461357 ] 

Edson Tirelli commented on JBRULES-1607:
----------------------------------------

We discussed this a couple weeks ago in the list. The special syntax for binding multiple patterns on "or" only works with infix "or". This is a legacy syntax that should be discouraged IMO as it often leads to user errors, promotes bad practices, is usually less efficient (performance wise) and is not orthogonal to the language overall syntax.

Please, use explicit bindings or the constraint connector || :

p: Person( 
       ( sex == "M" && age > 60 ) ||
       ( sex == "F" && age > 65 )
) 

I want to remove this syntax completely from the parser but could not convince Mark yet. 

I am not going to change the parser to support prefix OR with single binding unless someone gives me a good reason for it.

I am closing the ticket. If you have a good reason to use single bindings, talk to me.

> or with pattern binding doesn't work
> ------------------------------------
>
>                 Key: JBRULES-1607
>                 URL: https://jira.jboss.org/jira/browse/JBRULES-1607
>             Project: JBoss Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: drools-compiler
>    Affects Versions: 4.0.7, 5.0.0.M1
>            Reporter: Jaroslaw Kijanowski
>            Assignee: Edson Tirelli
>             Fix For: 5.0.0.GA
>
>
> When I use
> when
> (or 
>   p:Person( sex == "M", age > 60 )  
>   p:Person( sex == "F", age > 65 )
> ) 
> then
> end
> it works fine, but when I use
> when
> p:(or 
>   Person( sex == "M", age > 60 )  
>   Person( sex == "F", age > 65 )
> )
> it fails, however this should be allowed (at least it's in the docs, example 6.36).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list