[rules-dev] A note on the "switch" proposal for Drools 6.0

Mark Proctor mproctor at codehaus.org
Tue Jul 24 04:54:21 EDT 2012


The "break" proposed is more similar to prolog's "cut" used when rules 
are 'or'ed together, to stop alternative branches being evaluated.

Mark
On 24/07/2012 09:24, Wolfgang Laun wrote:
> The switch statement as we see it in C and Java is due to the classic
> "multiway branch" based on a (single) discrete value. As K&R note (in
> their book), "falling through" has an advantage: it permits more than
> one case label in front of code to be executed alike for all values.
> The disadvantage is the necessity of using "break" at the end of such
> a statement sequence.
>
> Other languages (Pascal, Modula, Ada,...) permit lists and ranges in
> case labels: hence there is no necessity for "break", and case
> branches are distinct alternatives.
>
> If the "switch" in the current proposal for Drools 6.0 has no (or no
> useful) interpretation of "falling through", then "break" should not
> be necessary.
>
> -W
> _______________________________________________
> rules-dev mailing list
> rules-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-dev



More information about the rules-dev mailing list