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: fluffy_dong@dsuper.net Subject: Re: scope and/or parameters (beginner) Date: 1999/04/15 Message-ID: <371c4201.2003123297@news.dsuper.net>#1/1 X-Deja-AN: 466839313 Content-Transfer-Encoding: 7bit References: <37064309.889106243@news.dsuper.net> <37084459.8616007@rocketmail.com> <370b0c99.1137352783@news.dsuper.net> <37155f01.1945002895@news.dsuper.net> <7f52vj$n90$1@nnrp1.dejanews.com> <7f59oi$tse$1@nnrp1.dejanews.com> Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.dsuper.net X-Trace: delphi.dsuper.net 924204839 16913 205.205.41.181 (15 Apr 1999 19:33:59 GMT) Organization: Delphi SuperNet Inc. Mime-Version: 1.0 NNTP-Posting-Date: 15 Apr 1999 19:33:59 GMT Newsgroups: comp.lang.ada Date: 1999-04-15T19:33:59+00:00 List-Id: 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.