<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
if we do implicit .? support people will still be able to do null
checks. So it's not one or the other.<br>
<br>
Mark<br>
On 28/07/2011 20:07, Greg Barton wrote:
<blockquote
cite="mid:1311880021.70231.YahooMailClassic@web81507.mail.mud.yahoo.com"
type="cite">
<table border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="font: inherit;" valign="top">+1
<div><br>
</div>
<div>Naw....</div>
<div><br>
</div>
<div>+billion<br>
<br>
--- On <b>Thu, 7/28/11, Edson Tirelli <i><a class="moz-txt-link-rfc2396E" href="mailto:ed.tirelli@gmail.com"><ed.tirelli@gmail.com></a></i></b>
wrote:<br>
<blockquote style="border-left: 2px solid rgb(16, 16,
255); margin-left: 5px; padding-left: 5px;"><br>
From: Edson Tirelli <a class="moz-txt-link-rfc2396E" href="mailto:ed.tirelli@gmail.com"><ed.tirelli@gmail.com></a><br>
Subject: Re: [rules-users] Condition syntax to access
Map<br>
To: "Rules Users List"
<a class="moz-txt-link-rfc2396E" href="mailto:rules-users@lists.jboss.org"><rules-users@lists.jboss.org></a><br>
Date: Thursday, July 28, 2011, 1:13 PM<br>
<br>
<div id="yiv864855709">
<div><br>
</div>
<div> All,</div>
<div><br>
</div>
<div> I think we need to differentiate paradigms
here. When using rules, contrary to imperative
code, what we are doing is pattern matching.</div>
<div><br>
</div>
<div>X( a.b.c == <value> )</div>
<div><br>
</div>
<div> In the above case, we are looking for Xs
that make that whole constraint true (i.e. match).
If a or b are null, the whole expression will be
false, does not matter the value of c or the value
it is being compared against. Raising a null
pointer exception, IMO, brings no advantage at all
to the table... on the contrary, makes writing
rules more difficult. </div>
<div><br>
</div>
<div> Another example we had in the past:</div>
<div><br>
</div>
<div>class Circle implements Shape</div>
<div>class Square implements Shape</div>
<div><br>
</div>
<div>rule X</div>
<div>when</div>
<div> Circle() from $shapes</div>
<div>...</div>
<div><br>
</div>
<div> In the above example, $shapes is a list and
the rule is clearly looking for Circles. If there
are Squares in there, they will just not match.
Raising a ClassCastException like it would happen
in an imperative language brings no advantage to
the table, IMO.</div>
<div><br>
</div>
<div> So, IMO, all property navigation should be
null pointer safe in the LHS of the rules. </div>
<div><br>
</div>
<div> This is not what happens today, but I think
it should be fixed.</div>
<div><br>
</div>
<div> Edson</div>
<div><br>
</div>
<div> </div>
<br>
<br>
<div class="yiv864855709gmail_quote">2011/7/28
Vincent LEGENDRE <span dir="ltr"><<a
moz-do-not-send="true" rel="nofollow"
ymailto="mailto:vincent.legendre@eurodecision.com"
target="_blank"
href="/mc/compose?to=vincent.legendre@eurodecision.com">vincent.legendre@eurodecision.com</a>></span><br>
<blockquote class="yiv864855709gmail_quote"
style="margin:0 0 0 .8ex;border-left:1px #ccc
solid;padding-left:1ex;">
<div>
<div style="font-family:Times New
Roman;font-size:12pt;color:#000000;">Hi all,<br>
<br>
I agree with W. : NPE should be the default,
and "null" cases behaviour should be planned
by programmers.<br>
But I am not sure about using a new operator
in rules (and do the update in Guvnor ...).
<br>
Why not using some drools annotations on the
getter specifying the behaviour of an eval
on a null value returned by this getter ? <br>
And may be these annotation could be added
to an existing POJO via the declared type
syntax (just like event role in fusion) ?<br>
<font color="#888888"><br>
Vincent.<br>
</font></div>
</div>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a moz-do-not-send="true" rel="nofollow"
ymailto="mailto:rules-users@lists.jboss.org"
target="_blank"
href="/mc/compose?to=rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a moz-do-not-send="true" rel="nofollow"
target="_blank"
href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br>
</blockquote>
</div>
<br>
<br clear="all">
<br>
-- <br>
Edson Tirelli<br>
JBoss Drools Core Development<br>
JBoss by Red Hat @ <a moz-do-not-send="true"
rel="nofollow" target="_blank"
href="http://www.jboss.com">www.jboss.com</a><br>
</div>
<br>
-----Inline Attachment Follows-----<br>
<br>
<div class="plainMail">_______________________________________________<br>
rules-users mailing list<br>
<a moz-do-not-send="true"
ymailto="mailto:rules-users@lists.jboss.org"
href="/mc/compose?to=rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a moz-do-not-send="true"
href="https://lists.jboss.org/mailman/listinfo/rules-users"
target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div>
</blockquote>
</div>
</td>
</tr>
</tbody>
</table>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
</blockquote>
<br>
</body>
</html>