Positive

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Oct 5 07:14:31 PDT 2008


Peter C. Chapin wrote:
> Andrei Alexandrescu wrote:
> 
>> Rats. I was thinking positive means >= 0 and strictly positive means >
>> 0. According to Wikipedia, positive really means strictly positive and
>> the longer-to-type NonNegative should be used instead :o|. For such a
>> simple concept, a short and sweet name is pivotal. If there are any
>> ideas for a better choice, please make them known.
> 
> Ada supports the ability to create new types from the primitive numeric
> types by adding range constraints to the primitive. The Ada community
> finds this useful and would appreciate the sort of feature you are
> talking about. In Ada there are even two predefined subtypes of Integer
> 
> 	subtype Positive is Integer range 1 .. Integer'Last;
> 	subtype Natural is Integer range 0 .. Integer'Last;
> 
> So for non-negative integers... what about "natural"?

Well uint kinda occupied that space, although as we all know it's not 
exactly a natural number.

I think the comparison with experience in Ada is sensible. I wished 
there was a predefined subtipe of Real too...


Andrei



More information about the Digitalmars-d mailing list