comp.lang.ada
 help / color / mirror / Atom feed
From: fjh@cs.mu.oz.au (Fergus Henderson)
Subject: Re: Beginner's question (array parameters to functions)
Date: 1998/12/02
Date: 1998-12-02T00:00:00+00:00	[thread overview]
Message-ID: <743o56$gsl$1@mulga.cs.mu.OZ.AU> (raw)
In-Reply-To: m3iufyykdy.fsf@mheaney.ni.net

Matthew Heaney <matthew_heaney@acm.org> writes:

 >fjh@cs.mu.oz.au (Fergus Henderson) writes:
 >
 >> Matthew Heaney <matthew_heaney@acm.org> writes:
 >> 
 >> >greg <ref15@columbia.edu> writes:
 >> >> One requirement of the assignment is that the
 >> >> sorting be done by a function which takes the array as a parameter and
 >> >> returns a sorted array.
 >> ...
 >> >> is there some way to avoid having to use two arrays?
...
 >> >Having two arrays is a condition of the problem statement,
 >> >and has nothing to do with the language.
 >> 
 >> This is not correct.
 >> 
 >> In some languages, e.g. C++, arrays can be passed and returned by
 >> reference, and can be modified, so (unless there was some additional
 >> constraint in the assignment, e.g. that the function's input argument
 >> not be modified) the two arrays could be the same array.
 >
 >That is precisely that case.  The requirement is for a function, not a
 >procedure.  Therefore, there is a requirement that the original array
 >not be modified.

That conclusion ("Therefore, ...") may be true if you restrict yourself to
Ada.  But there are other languages for which it is not true, as I
demonstrated by the examples in my reply.  Thus your statement that
"it has nothing to do with the language" is not correct.

 >> The fact that these two arrays have different contents is not a contraction,
 >> because the different contents occur at different times, and it's quite
 >> possible for a single array to have different contents at different times.
 >
 >I don't understand this paragraph.

Sorry -- I meant to write "contradiction" instead of "contraction".

--
Fergus Henderson <fjh@cs.mu.oz.au>  |  "Binaries may die
WWW: <http://www.cs.mu.oz.au/~fjh>  |   but source code lives forever"
PGP: finger fjh@128.250.37.3        |     -- leaked Microsoft memo.




      reply	other threads:[~1998-12-02  0:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-11-27  0:00 Beginner's question (array parameters to functions) greg
1998-11-28  0:00 ` Tom Moran
1998-11-28  0:00 ` Matthew Heaney
1998-11-28  0:00   ` Brian Rogoff
1998-11-29  0:00     ` Matthew Heaney
1998-11-29  0:00   ` Fergus Henderson
1998-11-29  0:00     ` Matthew Heaney
1998-12-02  0:00       ` Fergus Henderson [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