Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #36840

Re: null checks

From Martin Gregorie <martin@address-in-sig.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: null checks
Date 2017-07-08 22:26 +0000
Organization A noiseless patient Spider
Message-ID <ojrm6o$hq8$1@dont-email.me> (permalink)
References (2 earlier) <70f5af57-8dc0-416c-b2aa-0bbbb47fc7b5@googlegroups.com> <ojobsn$rh8$1@gioia.aioe.org> <wj8y35fwauls$.t07pxjfiv3wa.dlg@40tude.net> <ojri0j$j6$1@dont-email.me> <ojrjub$9vb$1@dont-email.me>

Show all headers | View raw


On Sat, 08 Jul 2017 17:51:45 -0400, Eric Sosman wrote:

>      ... but sometimes can be, in much the same way that Java can
> usually diagnose the use of a variable that may not have had a value
> assigned yet.  (By "usually" I don't mean that Java ever fails to
> diagnose an actual problem, but that it sometimes raises false alarms.)
>
Yes, agreed, but 'sometimes' covers a variety of sins which I didn't want 
to enumerate or qualify.

Besides, I have a fairly extensive C background and so naturally tend to 
prefer adding in runtime checks and to use null as, depending on context, 
as a completion signal or a "didn't succeed" return value. In the latter 
case I assume that those without a C background would throw an Exception 
while I'm more likely to write something like:

   Thing t = class.method();
   if (t == null)
   {
      class.getError(); 
      ...
   }
 
>      Perhaps we're reading the word "rely" a bit differently.  It
> seems to me that if the tool can give me some help, I can "rely" on that
> help.  I may not "rely entirely" on the tool, but, well, I'll gladly
> accept all the help I can get ...
>
Fair comment. In this case I tend not to 'rely' on static checks that can 
be overridden at runtime, bot of course ymmv and probably does. 


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

null checks Eric Douglas <e.d.programmer@gmail.com> - 2017-07-07 08:03 -0700
  Re: null checks Arne Vajhøj <arne@vajhoej.dk> - 2017-07-07 11:49 -0400
    Re: null checks Eric Douglas <e.d.programmer@gmail.com> - 2017-07-07 08:54 -0700
      Re: null checks Arne Vajhøj <arne@vajhoej.dk> - 2017-07-07 12:12 -0400
        Re: null checks Eric Douglas <e.d.programmer@gmail.com> - 2017-07-07 10:16 -0700
        Re: null checks Joerg Meier <joergmmeier@arcor.de> - 2017-07-08 22:33 +0200
          Re: null checks Martin Gregorie <martin@address-in-sig.invalid> - 2017-07-08 21:14 +0000
            Re: null checks Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-07-08 17:51 -0400
              Re: null checks Martin Gregorie <martin@address-in-sig.invalid> - 2017-07-08 22:26 +0000
            Re: null checks Arne Vajhøj <arne@vajhoej.dk> - 2017-07-08 18:28 -0400
            Re: null checks Joerg Meier <joergmmeier@arcor.de> - 2017-07-25 07:26 +0200
              Re: null checks Martin Gregorie <martin@address-in-sig.invalid> - 2017-07-25 12:12 +0000
          Re: null checks Arne Vajhøj <arne@vajhoej.dk> - 2017-07-08 18:20 -0400
            Re: null checks Eric Douglas <e.d.programmer@gmail.com> - 2017-07-10 05:35 -0700
        Re: null checks Robert Klemme <shortcutter@googlemail.com> - 2017-07-09 13:10 +0200
      Re: null checks Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-07-07 12:53 -0400
        Re: null checks lewbloch@gmail.com - 2017-07-26 11:16 -0700
          Re: null checks Eric Douglas <e.d.programmer@gmail.com> - 2017-07-26 11:40 -0700
            Re: null checks Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-07-26 16:40 -0400
            Re: null checks lewbloch@gmail.com - 2017-07-28 18:47 -0700
  Re: null checks Wayne <wayne@nospam.invalid> - 2017-07-07 16:24 -0400
  Re: null checks Joerg Meier <joergmmeier@arcor.de> - 2017-07-08 22:32 +0200
  Re: null checks Lothar Kimmeringer <news201705@kimmeringer.de> - 2017-07-09 15:59 +0200
    Re: null checks Arne Vajhøj <arne@vajhoej.dk> - 2017-07-11 20:30 -0400

csiph-web