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

Godmar Back godmar at gmail.com
Wed Oct 3 14:38:01 EDT 2007


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



More information about the rules-users mailing list