comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Naming convention to identify functions with side effects
Date: Mon, 29 Sep 2008 14:10:01 -0700 (PDT)
Date: 2008-09-29T14:10:01-07:00	[thread overview]
Message-ID: <2ed64106-52ef-4909-a0f0-ebb277856e8d@26g2000hsk.googlegroups.com> (raw)
In-Reply-To: 48e13f14$0$6610$9b4e6d93@newsspool3.arcor-online.net

On Sep 29, 1:48 pm, Georg Bauhaus <see.reply...@maps.futureapps.de>
wrote:

> Again, it might be tempting to pack the two calls in just
> one in order to hide the locking mechanism, to give the
> illusion of atomicity. But shouldn't normal Ada
> concurrency features be employed instead?

This is a bit too esoteric for me.  I think a much simpler reason for
the temptation to pack the two calls into just one is that it makes it
easier to stick the call into more complex Boolean expressions, e.g.
(assuming URL_Name's type is access string):

   if URL_Name /= null and then
      Load_Web_Page (URL_Name.all) then ...
      [stuff to do if we succeed]
   else ...
      [other stuff]
   end if;

Separating the procedure call and the query sounds like a great idea
theoretically, but it does mean that things such as the above must be
made more verbose (e.g. by adding a Boolean variable, as below:)

   if URL_Name = null then
      Success := False;
   else
      Web_Page.Load (URL_Name.all);
      Success := Web_Page.Is_Loaded;
   end if;
   if Success then ...

So, right or wrong, at least one can understand the temptation to
writing a Boolean function in order to make its use more concise in
such cases.

                                -- Adam




  reply	other threads:[~2008-09-29 21:10 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-29 18:17 Naming convention to identify functions with side effects Hibou57 (Yannick Duchêne)
2008-09-29 18:45 ` Hibou57 (Yannick Duchêne)
2008-09-29 18:55 ` Adam Beneschan
2008-09-29 19:52   ` Dmitry A. Kazakov
2008-09-29 20:48     ` Georg Bauhaus
2008-09-29 21:10       ` Adam Beneschan [this message]
2008-09-30 15:17         ` Georg Bauhaus
2008-09-30 17:40           ` Ray Blaak
2008-10-02 12:33       ` Ole-Hjalmar Kristensen
2008-10-03  9:18         ` Georg Bauhaus
2008-10-06  7:24           ` Ole-Hjalmar Kristensen
2008-10-03 11:51       ` Brian Drummond
2008-10-03 12:28         ` Dmitry A. Kazakov
2008-10-04 12:30           ` Marco
2008-10-04 13:05             ` (see below)
2008-10-04 15:14               ` Gary Scott
2008-10-11 11:32               ` Marco
2008-10-11 14:57                 ` Dmitry A. Kazakov
2008-10-11 16:05                 ` (see below)
2008-10-11 17:49                   ` Georg Bauhaus
2008-10-11 18:42                     ` (see below)
2008-10-03 13:15         ` Jeffrey Creem
2008-09-29 20:57 ` Georg Bauhaus
2008-09-29 22:22 ` Dr. Adrian Wrigley
replies disabled

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