[rules-users] MVEL curly braces position - bug or feature?

Wolfgang Laun wolfgang.laun at gmail.com
Tue Jan 10 07:18:27 EST 2012


You can create the same effect using
   while(...)
   {}
or
   do
  {} while( ... );
or
   for(;;)
   {}

You can't do  it with switch(){} because that's not accepted at all.

-W

2012/1/6 Edson Tirelli <ed.tirelli at gmail.com>

>
>    Looks like a bug. MVEL does ; injection in order to make ; optional, so
> my guess is that it is mistakenly injecting ; after your modify() call and
> handling {} as a separate code block.
>
>    Edson
>
>
> On Fri, Jan 6, 2012 at 11:51 AM, nickS <nsanders at msxi-euro.com> wrote:
>
>> Hi
>>
>> I've been learning drools ands I saw that there is a Fibonacci example,
>> so I
>> thought I'd write my own using mvel as the dialect and then compare it to
>> the model solution.
>>
>> However, I couldn't get mine working. It parsed but the behaviour was very
>> odd. It kept ignoring the modify block in my recurse rule and consequently
>> it went into an infinite loop. I compared it to the 'approved' solution
>> and
>> the two were pretty much the same, except that it worked and mine didn't.
>>
>> After a lot of checking I noticed that I had started my curly brace on a
>> new
>> line after modify but the example had continued straight after the closing
>> brace of the modify.
>>
>> Works //
>>
>> modify ( f ){
>>        value = 1
>>       };
>>
>> or
>>
>>  modify ( f ){value = 1 };
>>
>>
>> Doesn't Work //
>>
>> modify ( f )
>> {
>>      value = 1
>>  };
>>
>>
>> Does anyone know if this is a bug or a feature?
>>
>>
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/MVEL-curly-braces-position-bug-or-feature-tp3638341p3638341.html
>> Sent from the Drools: User forum mailing list archive at Nabble.com.
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
>
> --
>   Edson Tirelli
>   JBoss Drools Core Development
>   JBoss by Red Hat @ www.jboss.com
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120110/95280ad1/attachment.html 


More information about the rules-users mailing list