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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ae67f75abbc71211 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-02-26 17:09:05 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: byhoe@greenlime.com (Adrian Hoe) Newsgroups: comp.lang.ada Subject: Re: Why not using [] instead of () for array? Date: 26 Feb 2002 17:09:04 -0800 Organization: http://groups.google.com/ Message-ID: <9ff447f2.0202261709.3cc187d3@posting.google.com> References: <9ff447f2.0202241719.446bf17b@posting.google.com> NNTP-Posting-Host: 210.186.172.87 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1014772145 16161 127.0.0.1 (27 Feb 2002 01:09:05 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 27 Feb 2002 01:09:05 GMT Xref: archiver1.google.com comp.lang.ada:20486 Date: 2002-02-27T01:09:05+00:00 List-Id: byhoe@greenlime.com (Adrian Hoe) wrote in message news:<9ff447f2.0202241719.446bf17b@posting.google.com>... > I had a possibly fruitful discussion (a long one and solely discussed > about using Ada for joint-project) with a number of possible > co-workers this weekend. When I showed them a piece of Ada source > code, one (only) question was asked by these friends and I didn't know > exactly the answer. > > "Why not use [] instead of () for array in Ada?" > > Two reasons for [] is preferred to (): > > 1. More clarity, certainly leads to more readability. > > 2. More distinguishable from functions parameters and leads to 1. > > > Example 1 > ========= > matrix (1 .. 100); > > compares to > > matrix [1 .. 100]; > > > Example 2 > ========= > > do_matrix (8); > > a := matrix (8); > > compares to > > do_matrix (8); > > a:= matrix [8]; > > where do_matrix is a procedure (or can be function) which takes an > integer parameter to refer an array. Notice the use of matrix [8] > instantly distingusihes itself from a function/procedure with > parameter(s) compares to matrix (8). > > I don't know if this has been discussed before. But I think this is a > good question. What exactly the reason for using () rather than []? I > strongly believe a strong reason exists which I don't know. Anyone? > > -- Adrian Hoe > -- http://greenlime.com/users/adrian.hoe Thanks for clearing things up. Your points have prepared me more to answer questions like this. -- Adrian Hoe -- http://greenlime.com/users/adrian.hoe