<div> Hi Barry,</div><div><br></div><div> Sorry, I missed the context on this... as a "drools user", you should never have to worry about mvel strict/strong type configuration... </div><div><br></div><div> Just FYI, Drools internally uses a 2 phase compilation of mvel expressions, where the first is run in non-strict/strong mode to detect expression inputs, and then on the second time Drools sets MVEL to strong typing and provides the type information for all inputs. Again, this is internal and you should never need to know this.</div>
<div><br></div><div> What is happening?</div><div><br></div><div> Edson</div> <br><br><div class="gmail_quote">2010/6/9 Barry Kaplan <span dir="ltr"><<a href="mailto:groups1@memelet.com">groups1@memelet.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
>From the MVEL docs (<a href="http://mvel.codehaus.org/MVEL+2.0+Typing" target="_blank">http://mvel.codehaus.org/MVEL+2.0+Typing</a>):<br>
<br>
Strict Typing<br>
<br>
Strict typing in MVEL is an optional mode for the compiler, in which all<br>
types must be fully qualified, either by declaration or inference.<br>
<br>
Enabling Strict Mode<br>
When compiling an expression, the compiler can be put into strict mode<br>
through the ParserContext by setting setStrictTypeEnforcement(true).<br>
<br>
Satisfying type strictness can be accomplished both by requiring explicit<br>
declaration of types inside the expression, or by notifying the parser ahead<br>
of time of what the types of certain inputs are.<br>
<br>
For example:<br>
<br>
ExpressionCompiler compiler = new ExpressionCompiler(expr);<br>
<br>
ParserContext context = new ParserContext();<br>
context.setStrictTypeEnforcement(true);<br>
<br>
context.addInput("message", Message.class);<br>
context.addInput("person", Person.class);<br>
<br>
compiler.compile(context);<br>
<br>
In this example we inform the compiler that this expression will be<br>
accepting two external inputs: message and person and what the types of<br>
those inputs are. This allows the compiler to determine if a particular call<br>
is safe at compile time, instead of failing at runtime.<br>
Note about Generic Types<br>
You must use Strong Typing Mode to enable awareness of generic types. Type<br>
parameters for collections and other types will not be visible in<br>
strict-typing mode alone.<br>
Strong Typing<br>
<br>
Strong typing is a newly introduced mode in MVEL 2.0. It is different from<br>
strict mode in the sense that strongly typed mode requires that all<br>
variables be type qualified. Contrast this with strict mode which only<br>
requires that properties and method calls be qualified at compile-time.<br>
<br>
See the full article: Strong Typing Mode<br>
<font color="#888888">--<br>
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/MVEL-strict-mode-when-why-tp95666p883155.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/MVEL-strict-mode-when-why-tp95666p883155.html</a><br>
</font><div><div></div><div class="h5">Sent from the Drools - User mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> JBoss by Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>