comp.lang.ada
 help / color / mirror / Atom feed
From: "Ken Garlington" <Ken.Garlington@computer.org>
Subject: Re: if statements
Date: 2000/11/14
Date: 2000-11-14T00:00:00+00:00	[thread overview]
Message-ID: <kHaQ5.371$6W1.42895@news.flash.net> (raw)
In-Reply-To: E13vbW9-0000DP-00@Baldrick

"Duncan Sands" <sands@topo.math.u-psud.fr> wrote in message
news:E13vbW9-0000DP-00@Baldrick...

: Here
: is a code snippet using the Beer oriented methodology (which naturally
: reflects the life style of many students) that swaps the values of two
: integers A and B if A is the greater value.  It uses an if statement.

Well, this doesn't seem right. In particular:

:       type Beer is new Integer;
-- this should be Natural; the -1 trick is no excuse (see below).

:       type Hand is (Left_Hand, Right_Hand);
-- this should be type What_I_Call_My_Hands
-- there should be a type Hand which is an access to Beer_Mug (see below)
-- there should be a type Hands which is an array (What_I_Call_My_Hands) of
Hand.

:       Mugs : array (Hand) of Beer_Mug;
-- this should be two separate mugs, since a particular mug is not
intrinsically tied to a particular Hand

:       type Table is record
:          Mug : Beer_Mug;
:       end record;
-- clearly, Table should be an array (or set) of Beer_Mugs, since a Table
could
-- hold more than one Beer_Mug.

:       procedure Move_Mug (From, To : Hand) is
:       begin
:          if From = To or Mugs (From).Refreshing_Fluid = -1 then
-- Ack! Arbitrary constants! Much better to allow a Hand to be set to null
-- explicitly when it isn't accessing anything.
-- Also, need to check that To is empty.

:             raise Tasking_Error;
-- should really declare a new Drunken_Fool exception rather than using
-- predefined exception







  reply	other threads:[~2000-11-14  0:00 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-14  0:00 if statements Duncan Sands
2000-11-14  0:00 ` Ken Garlington [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-11-09  0:00 James Hassett
2000-11-10  0:02 ` Robert Dewar
2000-11-03 14:42 sc297
2000-11-03  0:00 ` David Starner
2000-11-07  0:00   ` John English
2000-11-13  0:00   ` Dale Pontius
2000-11-03 16:09 ` Larry Kilgallen
2000-11-03  0:00   ` tmoran
2000-11-03  0:00     ` David Starner
2000-11-05  0:00       ` tmoran
2000-11-06  0:00         ` David Starner
2000-11-08  0:14           ` Alejandro R. Mosteo
2000-11-08  0:00             ` Alejandro Villanueva
2000-11-08  0:00               ` Georg Bauhaus
2000-11-09  3:50               ` Ken Garlington
2000-11-07  0:00         ` John English
2000-11-03  0:00     ` Larry Kilgallen
2000-11-06  0:00       ` Brian Orpin
2000-11-07  0:00     ` John English
2000-11-08  5:22       ` Ken Garlington
2000-11-06  0:00 ` Daniel Allex
2000-11-07  0:00   ` Wes Groleau
2000-11-08  0:00     ` John English
2000-11-08  0:00       ` Wes Groleau
2000-11-09  3:43         ` Ken Garlington
2000-11-07  0:00   ` Ken Garlington
2000-11-07  0:00     ` John English
2000-11-07  0:00       ` Robert Dewar
2000-11-08  0:00         ` John English
2000-11-08  0:00           ` Georg Bauhaus
2000-11-09  4:58           ` Robert Dewar
2000-11-09  0:00             ` Ken Garlington
2000-11-09  0:00             ` John English
2000-11-08  5:29       ` Ken Garlington
2000-11-08  0:00         ` John English
2000-11-08  0:00           ` Ken Garlington
2000-11-07  0:00   ` John English
2000-11-07  0:00   ` dmitry6243
2000-11-07  0:00     ` Jean-Pierre Rosen
2000-11-08  0:00       ` dmitry6243
2000-11-07  0:00   ` Robert Dewar
2000-11-07  0:00     ` Larry Kilgallen
2000-11-08  0:00     ` Alejandro Villanueva
2000-11-08  0:00       ` Daniel Allex
2000-11-09  3:54       ` Ken Garlington
2000-11-09  5:24       ` Robert Dewar
2000-11-09  0:00         ` Ken Garlington
2000-11-09  0:00           ` Robert Dewar
2000-11-10  0:12             ` Ehud Lamm
2000-11-10  2:09             ` Ken Garlington
2000-11-20  0:00               ` Wes Groleau
2000-11-20  0:00             ` Wes Groleau
2000-11-21  0:00               ` Robert Dewar
2000-11-22  0:00                 ` Wes Groleau
2000-11-09  0:00         ` Marin David Condic
2000-11-09  0:00           ` Robert Dewar
2000-11-10  0:00             ` Larry Kilgallen
2000-11-10  1:58           ` Ken Garlington
2000-11-10  3:53             ` Robert Dewar
2000-11-07  0:00 ` John English
2000-11-07  0:00   ` Robert Dewar
2000-11-10  6:09 ` DJack143
replies disabled

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