[rules-users] suggestion for drl grammar: single-element constraints

Mark Proctor mproctor at codehaus.org
Thu Oct 4 02:30:57 EDT 2007


I've been thinking about this too, although I idea I had was for a 
default field.
List( > 5 ) from collect( Bus( color == "red" ) )

So we could define default fields that can be used in the way you said. 
Open a jira and we'll consider this for the next major release.

Mark
Godmar Back wrote:
> If a fact contains a single field, it would be nice to be able to
> express a constraint on the value of that field without having to know
> its name, e.g.:
>
> Cheese ("stilton")
>
> which would be equivalent to
>
> Cheese (type == "stilton")
>
> if Cheese contained only one field, and which would be a compile-time
> error otherwise.
>
> A similar convenience syntax is used, for instance, for Java 5
> annotations. Instead of having to say @Retention(value =
> RetentionPolicy.RUNTIME) it can be abbreviated
> @Retention(RetentionPolicy.RUNTIME) since this annotation only has a
> single field.
>
>  - Godmar
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>   




More information about the rules-users mailing list