<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 28/07/2011 13:53, Wolfgang Laun wrote:
<blockquote
cite="mid:CANaj1LfmQ7UtxwhGz6+3ApV_SF8ZedjqD9Umdscpq49vnWyhvA@mail.gmail.com"
type="cite">Two points to consider:<br>
<br>
(1) If a programmer writes<br>
a.getB().getC() == <something><br>
and a NPE happens due to a.getB() == null we may distinguish (a)
and (b) - see below.<br>
<br>
(a) The setup is so that this is to be expected but the programmer
forgot to take this possibility into account. Then we have:<br>
<br>
(a1) The consequence of a.getB() == null should be the same as
a.getB().getC() == null.<br>
<br>
(a2) If a.getB() == null, something else needs to be done, e.g.,
a.setB(x). If this is silently covered by the system, the absence
of handling will not be detected so easily.<br>
<br>
(b) The assumption is that a.getB() should never be == null in the
first place, but some other error (in data or code) caused this.
If this is silently covered by the system, this error will not be
detected so easily.<br>
<br>
<br>
(2) If a.getB().getC() == <something> returns false if
a.getB() is null, is this also the desired result if
<something> is "null", i.e., do you want<br>
a.getB().getC() == null<br>
to be false if a.getB() == null ?<br>
<br>
"Null safe navigation" is a nice try and *may* be tolerable, but
it should never be the default.<br>
</blockquote>
ok, sounds like we just need to add .? support into our parser then
- if it's not already supported.<br>
<br>
Mark<br>
<blockquote
cite="mid:CANaj1LfmQ7UtxwhGz6+3ApV_SF8ZedjqD9Umdscpq49vnWyhvA@mail.gmail.com"
type="cite"><br>
-W<br>
<br>
<br>
<div class="gmail_quote">On 28 July 2011 14:06, bolsover <span
dir="ltr"><<a moz-do-not-send="true"
href="mailto:david@bolsover.com">david@bolsover.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid
rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left:
1ex;">Thanks for the pointer to the MVEL documents - I can
forsee null-safe<br>
operator user.?<a moz-do-not-send="true"
href="http://manager.name" target="_blank">manager.name</a>
syntax being most useful.<br>
<br>
As for making the null test the default action - I'm not sure
- I can't say<br>
I have ever actually 'wanted' a nullpointer - but there may be
some special<br>
case.<br>
<br>
David<br>
<font color="#888888"><br>
--<br>
View this message in context: <a moz-do-not-send="true"
href="http://drools.46999.n3.nabble.com/Condition-syntax-to-access-Map-tp3204429p3206467.html"
target="_blank">http://drools.46999.n3.nabble.com/Condition-syntax-to-access-Map-tp3204429p3206467.html</a><br>
</font>
<div>
<div class="h5">Sent from the Drools: User forum mailing
list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a moz-do-not-send="true"
href="mailto: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>
</div>
</blockquote>
</div>
<br>
<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>