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,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-02-24 17:19:01 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: byhoe@greenlime.com (Adrian Hoe) Newsgroups: comp.lang.ada Subject: Why not using [] instead of () for array? Date: 24 Feb 2002 17:19:01 -0800 Organization: http://groups.google.com/ Message-ID: <9ff447f2.0202241719.446bf17b@posting.google.com> NNTP-Posting-Host: 210.186.172.34 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1014599941 7623 127.0.0.1 (25 Feb 2002 01:19:01 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 25 Feb 2002 01:19:01 GMT Xref: archiver1.google.com comp.lang.ada:20340 Date: 2002-02-25T01:19:01+00:00 List-Id: 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