comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: not null
Date: Wed, 4 Mar 2009 08:09:56 -0800 (PST)
Date: 2009-03-04T08:09:56-08:00	[thread overview]
Message-ID: <761a4fb8-de91-43b3-b420-55dbc06a61e7@k9g2000prh.googlegroups.com> (raw)
In-Reply-To: KEwrl.43389$EO2.26870@newsfe04.iad

On Mar 4, 6:56 am, Hyman Rosen <hyro...@mail.com> wrote:
> Georg Bauhaus wrote:
> > As said to have been seen on /.
> > another financial disaster, again caused
> > by making references to nothing, in Algol W,
> >http://qconlondon.com/london-2009/presentation/Null+References:+The+B...
>
> You are misreading the abstract. First of all, it's not
> about some particular incident. He's talking about the
> overall impact. Second, he's not talking about failure
> to check for null references, he's talking about having
> null references at all, so Ada is no better.

I'm having difficulty understanding the point.  You have to have the
idea of the lack of a reference.  How else would you implement a
linked list abstraction?  The first element has a reference to the
second, and the second has a reference to the third, but the last one
won't have a reference to anything.  This lack of a reference has to
be represented somehow, right?  Suppose that access values in Ada were
not allowed to have null values, and (for a linked list) you needed
the concept of a value that may or may not refer to another object.
You could write this as a variant record:

   type Obj_Reference (Present : Boolean) is record
      case Present is
         when True =>
            Ref : Obj_Access;  -- may not be null
         when False =>
            null;
      end case;
   end record;

I just don't see how this is an improvement; it simply shifts the
problem.  Whatever mistakes a programmer could in the actual Ada
language make by forgetting to check whether an access value is null,
he could make in the above example by forgetting to check the Present
discriminant.  And I suspect the same is true of any other "solution"
to the necessary concept of an "optional" reference that may refer to
an object or not; the set of mistakes you could make with that
solution is the same (if not greater) than the set you could make with
an access value that can be null---it's only that the syntax of those
mistakes would be different.

                              -- Adam






  parent reply	other threads:[~2009-03-04 16:09 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-04 14:44 not null Georg Bauhaus
2009-03-04 14:56 ` Hyman Rosen
2009-03-04 15:22   ` Georg Bauhaus
2009-03-04 16:16     ` Adam Beneschan
2009-03-05 14:24       ` Georg Bauhaus
2009-03-05 16:07         ` Adam Beneschan
2009-03-06  1:07       ` Hibou57 (Yannick Duchêne)
2009-03-04 16:09   ` Adam Beneschan [this message]
2009-03-04 20:38     ` Dmitry A. Kazakov
2009-03-05  1:54       ` Adam Beneschan
2009-03-05  8:42         ` Dmitry A. Kazakov
2009-03-05  1:32     ` Brian Drummond
2009-03-05  1:47       ` Adam Beneschan
2009-03-05 11:32         ` Brian Drummond
2009-03-05 15:06           ` Dmitry A. Kazakov
2009-03-05 13:57         ` Georg Bauhaus
2009-03-05 19:53       ` Jack Mitchell
2009-03-05  8:49     ` Jacob Sparre Andersen
2009-03-05 16:10       ` Adam Beneschan
2009-03-05 17:20         ` Jacob Sparre Andersen
2009-03-06  1:04     ` Hibou57 (Yannick Duchêne)
2009-03-06 12:01     ` Harald Korneliussen
2009-03-06 12:43       ` Jacob Sparre Andersen
2009-03-06 13:05         ` Harald Korneliussen
2009-03-06 15:21       ` Dmitry A. Kazakov
2009-03-06 16:59         ` Harald Korneliussen
2009-03-06 17:48           ` Dmitry A. Kazakov
2009-03-06 20:05             ` Georg Bauhaus
2009-03-06 21:31               ` Dmitry A. Kazakov
2009-03-04 16:19   ` Robert A Duff
2009-03-04 20:39 ` Colin Paul Gloster
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox