Re: Default array base index
- From: "Dmitry A. Kazakov" <mailbox@xxxxxxxxxxxxxxxxx>
- Date: Mon, 28 Jan 2008 19:50:04 +0100
On Mon, 28 Jan 2008 09:02:51 -0800 (PST), Adam Beneschan wrote:
Also, we always number everything else starting
with "first", "second", etc.; ever seen a baseball game played with
"zero-th base", "first base", and "second base"? ("Who's on zero-
th?" "Yes."
"I mean his name." "Who." "The guy on zero-th." "Who." "The zero-
th baseman." "Who." Just doesn't have the same ring to it.) So it
isn't an "Ada culture" at all---it's the fact that using 1 seems more
natural, and that I get to use a language that gives me a choice,
rather than struggling with a low-level language like C that forces me
into unnatural behaviors like using 0 as the index base.
I think it boils down to the semantic difference between numerals and
ordinals. The problem arises when the same notation is attempted for both.
When 1 denotes an ordinal (the first) then 0 does not exist. There is
nothing before the first. But in the set of natural numbers 0 is the first
number. So 0 = 1. In some other set it could be the second or none. In Ada
the first ordinal used for arrays as sets is A'First, so the first element
is A(A'First), and not necessarily either A(1) or A(0).
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
.
- References:
- Default array base index
- From: Scott Burson
- Re: Default array base index
- From: Adam Beneschan
- Default array base index
- Prev by Date: Re: Interfaces and private types
- Next by Date: Re: ANN: GNAT/GPL Solaris 10: 2007-solaris-x86
- Previous by thread: Re: Default array base index
- Next by thread: ANN: GNAT/GPL Solaris 10: 2007-solaris-x86
- Index(es):
Relevant Pages
|