comp.lang.ada
 help / color / mirror / Atom feed
From: fluffy_doo@dsuper.net
Subject: Re: scope and/or parameters (beginner)
Date: 1999/04/05
Date: 1999-04-05T00:00:00+00:00	[thread overview]
Message-ID: <370b0c99.1137352783@news.dsuper.net> (raw)
In-Reply-To: 37084459.8616007@rocketmail.com

On Mon, 05 Apr 1999 05:04:25 +0000, Corey Ashford 

> ...
>"IN" parameters are considered read-only.  You've tried to pass it to
>a procedure which may attempt to change its value - something that
>isn't allowed to a read-only variable.  Treat "IN" parameters as
>constants that are defined when the subprogram is invoked.
>
>[snip]

>Well, you could change the definition of One_prog so that its
>Second_Variable is of type "IN OUT The_Type", instead of just IN.  Then
>you could call Inner_Procedure legally with Second_Variable.
>
>- Corey

But that is part of my main objective: to have it as "IN" in the first
subprogram (One_Procedure), and then as "IN OUT" for the subprogram
one level below (Internal_Procedure).  It's just an exercise I've made
for myself to help me better understand the formal/actual parameter
manipulation.  I want Var_2 to remain unchanged at the main program
level.  Let's say I want to use that variable (its original value)
later in the program, in a subprogram called directly from the main
program, which is why I insist on having an "IN" parameter in
One_Procedure.

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.

This exercise, in part learning to use "named" instead of "positional"
association, has allowed me to realize the following, I think :

	The fact that a sub-program is declared INSIDE another, as
	opposed to OUTSIDE of it, makes no difference from the point of
	view of the compiler.  As long as any call to a sub-program is
	made AFTER its declaration it is treated exactly the same way.

TRUE / FALSE ?

Thanks again.  How come the people in this group are so helpful and
straight forward, much more than in other groups I've frequented
before ?  Is this part of some organized campain with the purpose of
popularizing Ada ?  It is a if the people here were paid to do it and
truly enjoyed it on top of it !


Marc Galipeau
--
What I really am is "fluffy", no "_dong",
no "_puff", no "_woo", no  nothing, just plain fluffy.






  reply	other threads:[~1999-04-05  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 [this message]
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                       ` dennison
1999-04-15  0:00                       ` Hyman Rosen
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
replies disabled

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