From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a1a88c4d509f6381 X-Google-Attributes: gid103376,public From: Samuel Mize Subject: Re: scope and/or parameters (beginner) Date: 1999/04/16 Message-ID: <7f7k67$e2p@news1.newsguy.com>#1/1 X-Deja-AN: 467171119 References: <37064309.889106243@news.dsuper.net> <37084459.8616007@rocketmail.com> <370b0c99.1137352783@news.dsuper.net> <37155f01.1945002895@news.dsuper.net> Organization: ImagiNet Communications, Ltd. User-Agent: tin/pre-1.4-981002 ("Phobia") (UNIX) (AIX/3-2) Newsgroups: comp.lang.ada Date: 1999-04-16T00:00:00+00:00 List-Id: 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