comp.lang.ada
 help / color / mirror / Atom feed
From: Keith Thompson <Keith.S.Thompson+u@gmail.com>
Subject: Re: What is the history behind Natural'First = 0 ?
Date: Fri, 01 May 2020 12:03:14 -0700
Date: 2020-05-01T12:03:14-07:00	[thread overview]
Message-ID: <874ksz4gwd.fsf@nosuchdomain.example.com> (raw)
In-Reply-To: r8gkf4$ul2$1@dont-email.me

"J-P. Rosen" <rosen@adalog.fr> writes:
> Le 01/05/2020 à 06:51, reinert a écrit :
>> Why Natural'First = 0 ?
>> 
> Because that's the way it is  ;-)
>
> Anyway, type Integer is not the mathematical notion of (infinite)
> integers, and more generaly computer types are only reduced abstractions
> of mathematical notions.
>
> There is a need for a subtype of type Integer with lower bound 0, and
> another one for lower bound 1. The names have been chosen by Ichbiah
> following usual practice, they could have been anything else.

When I was learning about sets of numbers in elementary school, we
were told that the natural numbers are positive integers and the
whole numbers are non-negative integers (including 0).  Based on
that, if I had been designing the language I probably would have used
the name Natural for 1..Integer'Last and Whole for 0..Integer'Last.

On the other hand, the word "Whole" sounds like "Hole" (at least
in my version of non-accented American English), so I can see that
being awkward in some contexts.

Wikipedia says that some definitions have "natural numbers" starting
with 0, and others have them starting with 1 -- and the term "whole
numbers" is sometimes used to refer to the set of all integers.

It's ultimately arbitrary.  I found the use of Natural in Ada
slightly jarring the first time I encountered it, but I have no
complaints.  And the name Positive seems entirely reasonable.

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips Healthcare
void Void(void) { Void(); } /* The recursive call of the void */

  parent reply	other threads:[~2020-05-01 19:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-01  4:51 What is the history behind Natural'First = 0 ? reinert
2020-05-01  7:52 ` J-P. Rosen
2020-05-01  8:38   ` AdaMagica
2020-05-01 10:24     ` J-P. Rosen
2020-05-01 19:03   ` Keith Thompson [this message]
2020-05-01 21:36     ` Robert A Duff
2020-05-03 20:08       ` Keith Thompson
2020-05-04  3:02         ` Keith Thompson
2020-05-04  8:50           ` Paul Rubin
2020-05-04 14:22           ` Dennis Lee Bieber
2020-05-01 10:13 ` Jeffrey R. Carter
2020-05-01 18:14 ` Optikos
replies disabled

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