Ada use of parens vs brackets

Aharon Robbins <arnold@skeeve.com>
11 Dec 2004 12:29:35 -0500

          From comp.compilers

Related articles
Re: Using Bison and Delphi mikehahn@rogers.com (Mike Hahn) (2004-11-20)
Re: Using Bison and Delphi vbdis@aol.com (2004-11-26)
Re: Using Bison and Delphi mikehahn@rogers.com (Mike Hahn) (2004-12-05)
Re: Using Bison and Delphi strohm@airmail.net (John R. Strohm) (2004-12-06)
Ada use of parens vs brackets arnold@skeeve.com (Aharon Robbins) (2004-12-11)
Re: Ada use of parens vs brackets mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2004-12-13)
Re: Ada use of parens vs brackets nick.roberts@acm.org (Nick Roberts) (2004-12-16)
| List of all articles for this month |

From: Aharon Robbins <arnold@skeeve.com>
Newsgroups: comp.compilers
Date: 11 Dec 2004 12:29:35 -0500
Organization: Compilers Central
References: 04-11-078 04-11-099 04-12-036 04-12-041
Keywords: Ada, syntax, history
Posted-Date: 11 Dec 2004 12:29:35 EST

Greetings all,


Earlier, I asked the question of where is there chapter and verse on
why Ada chose parens for arrays. It was indeed so that arrays and
functions look the same. An Ada expert friend of mine (Professor
Richard J. LeBlanc of Georgia Tech) says:


> This point is explicitly discussed at the end of section 3.4 (Names)
> of the Rationale, on pages 22-23, if you want a complete "chapter
> and verse" citation!


This of course, didn't tell me what the document actually *said*.
Upon asking that questions, he replied:


> Here's the quote. The context begins with a discussion of Ada allowing
> function calls in names, as Simula did. I have left out reference
> citations and and cross-references to other sections of the document.
>
> ---------------------
> The ability to use function calls in names is especially useful when
> dealing with data structures constructed with access types. Thus an
> algorithm in a tree traversal may include names such as
>
> NEXT(N).PART
>
> where NEXT(N) delivers an access value, and where PART is a component
> of the object designated by the access value. In this case, reading
> and updating the component PART are both possible.
>
> This ability goes some way toward the principle of uniform referents
> advocated by Ross and others. Following this principle, Ada uses round
> brackets rather than square ones for denoting array components, thereby
> unifying the syntax of indexed components and function calls. In the
> same spirit, the syntax of selected components is used for component
> selection of records, whether the records are statically or dynamically
> allocated.
> -----------------------
>
> Note that the last sentence is referring to the fact that no explicit
> dereference operator is used when accessing a component of a record
> referenced by a pointer.


So, I thank him for enlightening me, and pass the info on, to set
the record straight.


Arnold Robbins


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.