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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,c7d533acec91ae16 X-Google-Attributes: gid103376,public From: Paul Duquennoy Subject: Re: Question for the folks who designed Ad Date: 1999/04/29 Message-ID: <3727FEB6.6ECEB1F5@wanadoo.fr>#1/1 X-Deja-AN: 472185134 Content-Transfer-Encoding: 8bit References: <7g72rf$hjh3@ftp.kvaerner.com> <7g8roe$igd1@svlss.lmms.lmco.com> Content-Type: text/plain; charset=iso-8859-1 X-Complaints-To: abuse@wanadoo.fr X-Trace: wanadoo.fr 925367874 28542 164.138.203.159 (29 Apr 1999 06:37:54 GMT) Organization: Wanadoo, l'internet avec France Telecom Mime-Version: 1.0 Reply-To: paul.duquennoy@wanadoo.fr NNTP-Posting-Date: 29 Apr 1999 06:37:54 GMT Newsgroups: comp.lang.ada Date: 1999-04-29T06:37:54+00:00 List-Id: David Kristola wrote: > > In article hjh3@ftp.kvaerner.com, "Tarjei Tj�stheim Jensen" () writes: > > > >Robert Dewar wrote : > >> > >>In other words: > >> > >> a(5) > >> > >>is a reference to a mapping, and you want the range value > >>given the domain value 5. Whether this is implemented by > >>an array or a function is an implementation detail that > >>should not affect the syntactic form of reference. > > > > > >What would a(5) := 4; mean then? You cannot assign to a function as far as I > >know. Which in my opinion voids the function opposition to the common > >convention of using square brackets for array indices. > > > >I don't mind if the function addicts still writes a(5) := 4, if I can write > >a[5] := 4. > > > >Greetings, > > > > > > > > a(5).some_value := 4; > > Maybe the function a returns a pointer to a record structure... > Absolutely, and this is useful. An early version of a package can use an array to implement a feature, but later it can be changed to a more sophisticated approach using a cache (e.g. if there are too many unused entries in the array) without disturbing the existing code. It is then clear that the 'a(5)' is a way to access some data, regardless of its implementation. Ada allows very minimal impact on the code in such circumstances. The 'auto-dereferencing' of pointers in Ada (vs '->' in C) also gives more flexibility to change the implementation from actual data to accesses and vice-versa.