Hacker News new | past | comments | ask | show | jobs | submit login

Nim has Natural and Positive (signed int) types that checked at compile and runtime. You can also define arbitrary range types for any ordinal type, for example enums:

  type
    Month = enum Jan, Feb, Mar, Apr, May, ...
    SpringMonth = range[Mar..May]
  
  var m: SpringMonth = Mar
It will raise under/overflow exception if value falls out of range.





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: