comp.lang.ada
 help / color / mirror / Atom feed
From: Samuel Mize <smize@imagin.net>
Subject: Re: scope and/or parameters (beginner)
Date: 1999/04/16
Date: 1999-04-16T00:00:00+00:00	[thread overview]
Message-ID: <7f7k67$e2p@news1.newsguy.com> (raw)
In-Reply-To: 37155f01.1945002895@news.dsuper.net

fluffy_dong@dsuper.net wrote:
>>fluffy_doo@dsuper.net writes:
>>
>>> It looks like I am forced to declare a *new variable* in One_Procedure
>>> to which I will give the value of Var_2 (Ex: modif_Var_2 := Var_2;),
>>> and then send modif_Var_2 in Internal_Procedure to be modified and
>>> brought back via its "IN OUT" parameter.
...
> What I'm surprised about is not about a passage through a single
> sub-program, but through two (2) of them in line, two levels down.  I
> would have expected the IN parameter to protect the value against
> modification only for the sub-program from which it was first passed
> but not for the second one.  As it stands, if a variable is passed
> down several sub-programs, it must keep the same passage mode
> throughout the entire line.  I wonder why they made it this way.

So that you can reason effectively about code, especially code that
calls the procedure.

If you see a procedure definition:

    procedure Xyzzy (Fee: in Integer; Fie: in out Integer);

You can call it knowing that the value of Fee won't be changed.

Also, as (IIRC) Robert Dewar explained, inside Xyzzy, you can reason
use Fee with confidence that it hasn't been altered, used as a scratch
variable, or whatever.

Best,
Sam Mize

-- 
Samuel Mize -- smize@imagin.net (home email) -- Team Ada
Fight Spam: see http://www.cauce.org/ \\\ Smert Spamonam




      parent reply	other threads:[~1999-04-16  0:00 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-02  0:00 scope and/or parameters (beginner) fluffy_pink
1999-04-03  0:00 ` Matthew Heaney
1999-04-05  0:00 ` Corey Ashford
1999-04-05  0:00   ` fluffy_doo
1999-04-06  0:00     ` Matthew Heaney
1999-04-08  0:00     ` czgrr
1999-04-10  0:00       ` fluffy_puff
1999-04-12  0:00       ` dennison
1999-04-13  0:00         ` Robert Dewar
1999-04-13  0:00         ` czgrr
1999-04-13  0:00           ` Robert Dewar
1999-04-14  0:00             ` czgrr
1999-04-14  0:00               ` Robert Dewar
1999-04-15  0:00                 ` czgrr
1999-04-15  0:00                   ` Robert Dewar
1999-04-14  0:00               ` dennison
1999-04-13  0:00     ` Robert A Duff
1999-04-14  0:00       ` Robert Dewar
1999-04-14  0:00         ` Hyman Rosen
1999-04-14  0:00           ` dennison
1999-04-14  0:00             ` Hyman Rosen
1999-04-14  0:00               ` dennison
1999-04-14  0:00                 ` Hyman Rosen
1999-04-15  0:00                   ` dennison
1999-04-15  0:00                     ` Robert Dewar
1999-04-15  0:00                       ` Hyman Rosen
1999-04-15  0:00                       ` dennison
1999-04-15  0:00           ` Robert Dewar
1999-04-15  0:00             ` Hyman Rosen
1999-04-15  0:00               ` Robert Dewar
1999-04-15  0:00                 ` Hyman Rosen
1999-04-16  0:00               ` Rakesh Malhotra
1999-04-15  0:00       ` fluffy_dong
1999-04-15  0:00         ` Robert Dewar
1999-04-15  0:00           ` dennison
1999-04-15  0:00             ` fluffy_dong
1999-04-16  0:00               ` Robert Dewar
1999-04-16  0:00                 ` Fraser Wilson
1999-04-16  0:00                   ` Gautier.DeMontmollin
1999-04-20  0:00                     ` Nick Roberts
1999-04-21  0:00                     ` fraser
1999-04-22  0:00               ` Robert A Duff
1999-04-22  0:00                 ` Larry Kilgallen
1999-04-16  0:00         ` Samuel Mize [this message]
replies disabled

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