comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Dewar <robert_dewar@my-deja.com>
Subject: Re: Containers with Ada
Date: 2000/11/19
Date: 2000-11-19T00:00:00+00:00	[thread overview]
Message-ID: <8v8us5$hnm$1@nnrp1.deja.com> (raw)
In-Reply-To: 8v8pii$dvo$1@nnrp1.deja.com

In article <8v8pii$dvo$1@nnrp1.deja.com>,
  jeltsch@my-deja.com wrote:
>    1. Copying of large data structures
>    In my opinion one main problem of Ada is implicit copying
> of variables. So
>    it's no good idea to define such a intuitive function like
>       function Element_At(Current_List : in List;
Current_Index : in Index)
>                          return Element;
>    In this example the list which could contain thousands of
elements would
>    be copied just to get one element out of it.


This is such a fundamental misconception, that you need to
go back and start at square one. No compiler I can imagine
would decide that it was more efficient to copy this list
if it had thousands of elements.

You seem to have somehow picked up the idea that IN parameters
are always copied. This of course is NOT the case in Ada.
Indeed the expectation is precisely that large objects passed
as IN parameters will be passed by reference. The compiler makes
the choice based on what is most efficient. YOU are NOT in the
business of worrying about efficiency at this level, and as
you show, if you do start worrying, you are very likely to get
yourself seriously confused :-)


Sent via Deja.com http://www.deja.com/
Before you buy.




  parent reply	other threads:[~2000-11-19  0:00 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-19  0:00 Containers with Ada jeltsch
2000-11-19  0:00 ` Robert Dewar
2000-11-19  0:00 ` Ken Garlington
2000-11-20  0:00   ` Wolfgang Jeltsch
2000-11-20  0:00   ` Wolfgang Jeltsch
2000-11-19  0:00 ` Robert Dewar
2000-11-20  0:00   ` Wolfgang Jeltsch
2000-11-19  0:00 ` Robert Dewar [this message]
2000-11-19  0:00 ` Robert Dewar
2000-11-20  4:37   ` Brian Rogoff
2000-11-20  0:00     ` Ted Dennison
2000-11-20  0:00       ` Brian Rogoff
2000-11-20  0:00 ` Marc A. Criley
2000-11-20  0:00   ` Brian Rogoff
2000-11-20  0:00     ` Stephen Leake
2000-11-20  0:00       ` Brian Rogoff
2000-11-21  0:00       ` Marc A. Criley
2000-11-21  0:00       ` Warren W. Gay VE3WWG
2000-11-21  0:00         ` Stephen Leake
2000-11-21  0:00           ` Warren W. Gay VE3WWG
2000-11-21  0:00             ` Stephen Leake
2000-11-22  0:00               ` Warren W. Gay VE3WWG
2000-11-22  0:00               ` Containers with Ada (distribution of) Warren W. Gay VE3WWG
     [not found]                 ` <004d01c0567b$cd4e49c0$b0375140@Fudge>
2000-11-25  0:00                   ` Does anyone use Anna? Lao Xiao Hai
2000-11-20  0:00   ` Containers with Ada Wolfgang Jeltsch
replies disabled

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