comp.lang.ada
 help / color / mirror / Atom feed
From: byhoe@greenlime.com (Adrian Hoe)
Subject: Why not using [] instead of () for array?
Date: 24 Feb 2002 17:19:01 -0800
Date: 2002-02-25T01:19:01+00:00	[thread overview]
Message-ID: <9ff447f2.0202241719.446bf17b@posting.google.com> (raw)

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



             reply	other threads:[~2002-02-25  1:19 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-25  1:19 Adrian Hoe [this message]
2002-02-25  1:48 ` Why not using [] instead of () for array? Larry Kilgallen
2002-02-25  3:14   ` Darren New
2002-02-25 10:14   ` Peter Hermann
2002-02-25  3:23 ` Dale Stanbrough
2002-02-25  5:28 ` David Starner
2002-02-25 14:39   ` Robert Dewar
2002-02-26  7:56     ` Mats Karlssohn
2002-02-27  4:52       ` Robert Dewar
2002-02-27 16:44         ` Darren New
2002-02-27 14:29       ` David Starner
2002-02-27  0:50     ` Adrian Hoe
2002-02-27 17:37       ` Jeffrey Carter
2002-02-25 18:46 ` Toshitaka Kumano
2002-02-27  4:54   ` Robert Dewar
2002-02-27  8:48     ` Dmitry A. Kazakov
2002-02-28  5:29       ` Adrian Hoe
2002-02-28 21:39       ` Florian Weimer
2002-02-27  1:09 ` Adrian Hoe
  -- strict thread matches above, loose matches on Subject: below --
2002-02-28  6:37 Christoph Grein
2002-02-28 22:56 ` Jeffrey Carter
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox