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

2012-01-10 Thread Wolfgang Laun
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.tire...@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 nsand...@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@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@lists.jboss.org
 https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


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

2012-01-06 Thread nickS
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@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


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

2012-01-06 Thread Edson Tirelli
   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 nsand...@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@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@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users