comp.lang.ada
 help / color / mirror / Atom feed
From: Christoph Grein <christoph.grein@eurocopter.com>
Subject: Re: if statement
Date: Wed, 20 Mar 2002 07:05:52 +0100 (MET)
Date: 2002-03-20T07:05:52+01:00	[thread overview]
Message-ID: <mailman.1016604482.29531.comp.lang.ada@ada.eu.org> (raw)

>       Put(Sum, 1, 2, 0);

Note that in Ada you have named parameter associations. The above is hardly 
readable, who remembers which is which. Use instead

   Put (Sum, Fore => ..., Aft => ..., Exp => ...);

But please do not exaggerate as some do by always writing

   P (X => X, Y => Y)

for all subprogram calls where the named association does not add any 
information. However

  arctan (X => X, Y => Y)

is a completely different beast. The definition has parameter Y first, X second 
(for good mathematical reasons), so if you simply write

  arctan (X, Y)

it's unclear whether you really meant

  arctan (X => X, Y => Y)

or

  arctan (X => Y, Y => X)

So always try to give as much information as possible by providing named 
associations. If actual parameter names already provide enough and types are 
different, there is no need to use named association.



             reply	other threads:[~2002-03-20  6:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-20  6:05 Christoph Grein [this message]
2002-03-21  6:25 ` if statement Simon Wright
  -- strict thread matches above, loose matches on Subject: below --
2002-03-17 13:46 Karl-Johan Karlsson
2002-03-17 16:58 ` Steve Doiel
2002-03-19 19:23 ` Pheet
replies disabled

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