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, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c56a86f3a4e16d06 X-Google-Attributes: gid103376,public From: Robert Dewar Subject: Re: Containers with Ada Date: 2000/11/19 Message-ID: <8v8us5$hnm$1@nnrp1.deja.com>#1/1 X-Deja-AN: 695433911 References: <8v8pii$dvo$1@nnrp1.deja.com> X-Http-Proxy: 1.0 x52.deja.com:80 (Squid/1.1.22) for client 205.232.38.240 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Sun Nov 19 16:24:40 2000 GMT X-MyDeja-Info: XMYDJUIDrobert_dewar Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.61 [en] (OS/2; I) Date: 2000-11-19T00:00:00+00:00 List-Id: 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.