Hacker News new | ask | show | jobs
by zzzcpan 2490 days ago
> If you want a number to be a positive integer you would write a Go struct containing a uint. That's all.

Uint is a specific machine type, not an abstract positive integer type. So if you want a positive integer in Go you are fucked. If you try to use uint for that you have to carefully handle a whole bunch of edge cases. It's only in some dynamically typed languages a positive integer will be a positive integer and in better ones numeric operations will even be separate from string operations, so doing APIs will be significantly safer than in Go.