comp.lang.ada
 help / color / mirror / Atom feed
From: fluffy_dong@dsuper.net
Subject: Re: scope and/or parameters (beginner)
Date: 1999/04/15
Date: 1999-04-15T19:33:59+00:00	[thread overview]
Message-ID: <371c4201.2003123297@news.dsuper.net> (raw)
In-Reply-To: 7f59oi$tse$1@nnrp1.dejanews.com

On Thu, 15 Apr 1999 18:05:12 GMT, in comp.lang.ada you wrote:

>> What I am surprised about is that you could think this :-)
>>
>> (and I read what you said ...)
>>
>> constant in Ada means constant, it does not mean
>> "constant, except that if you call a second level procedure
>> you are allowed to modify it"

I know that and I am curious as to why the people who designed Ada
made it this way, as opposed to the way that I described.  If there is
no OUT then it would/should not matter what is done to the value
passed because it's not coming back.  It would/should be treated as an
idependent copy of the variable passed.  I know that is not the way it
works.  Why not? (Don't answer. It's been answered below.)

>I suspect he was thinking something along the lines of:
>My parameters are being passed via a copy method: "in out" is copy-in-copy-out
>and "in" is just copy-in. Therefore there's no harm in allowing the *copy*
>inside the ourter routine to be modified, since the modification will not be
>copied out.

That is exactly what I was thinking about.  (Keep in mind, that I
don't have much experience in programming: a bit of C++, a bit of
Visual Basic, and one Ada course I'm presently taking, only school.)

>Of course the fallacy in that is that the Ada compiler (in most cases) is
>perfectly free to choose to pass those parameters by reference instead of
>copy.

That's the answer I was looking for, perhaps obvious to some but not
to me.  It's a bit over my head but it is what I needed to know.
Before this I knew one and only one thing about compilers: they
translate  code into assembly language.  Now I know two things (about
the *Ada* compiler).

>So if you rely on the copy mechanisim in order for your algorithm to
>work, you will have to do the copying youself!

Thanks

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






  reply	other threads:[~1999-04-15  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         ` 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 Dewar
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 [this message]
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