here is the code on the https://nim-lang.org/
however,
= range 0..9223372036854775807(int)
how do I know? Just assign a float to age. then nim refuse to compile.
so it is a very bad example
import strformat
type
Person = object
name: string
age: Natural # ensures the age is positive
btw, is there any builtin type which is true positive integer
Yes, to be technically correct Natural is non-negative (from zero and above), and Positive is strictly positive (from one above).
https://nim-lang.github.io/Nim/system.html#Natural
Nim isn't the only language to define Natural and Positive in this way. Ada does the same thing, and that's the language people reputedly use to fly airplanes and run the train system. So the Nim devs can't be entirely on the wrong track (no pun intended).
I guess your complaint is that age should not be of type Natural. That probably depends on what's needed in the application. Lots of people only ever display a natural number for their age.
It also depends on your culture.
In French the equivalent of positive (positif) when used in math means 0 or more, otherwise we use strictly positive. This is different from English (or maybe just US).
Also in Asian countries, your age starts at 1 not 0 (and for some, or maybe it was in the past, you change age at the beginning of the year, i.e. legally everyone's birthday was on January 1st).
AFAIK airplanes didn't crash yet due to missed "birthday" maintenance ;).
no known man has a age of 9223372036854775807 years old!
While true, there are many things which have an age much greater than that of a human. The age of a building, country, civilization, planet, or even the age of the Universe. And, there are also physical "ages" which exceed even that of the range defined: the half-life of krypton-78 is 9.2e21 years.
Sorry, I’m French and for me positive means strictly positive (as negative means strictly negative), but to avoid any ambiguity, I always use « strictement positif » for numbers > 0 and « positif ou nul » for numbers ≥ 0.
Some authors (Bourbaki for instance) considers that zero is both a positive and a negative number. But these are exceptions (see Wikipedia on this topic).
It depends on authors. I said that French people generally consider 0 as being neither positive nor negative. For instance, a positive temperature is above 0°C.
For the french mathematician group Nicolas Bourbaki, which is a well known reference, zero is both positive and negative. But that not means that all mathematicians (being french or not) agree with this. I rather think that it is a non standard definition of positive (and negative). Bourbaki had certainly good reasons to do this, but I think it makes things more complicated. It’s better when the mathematical definitions are consistent with the common sense. And, in fact, I do not know of any other mathematicians who have adopted this point of view.
For Wikipedia in english – see https://en.wikipedia.org/wiki/Positive_real_numbers – a positive number is clearly greater than zero and, this, from a mathematical point of view. But, even in English, your video shows that there is still discussion on this topic.