News for hackers. Stuff that matters.
Re:Use Your Type System by archargelod on Thursday July 24, 2025 @11:27PM (#44679282)
Nim[0] supports subrange types:

  type
    Foo = range[1 .. 10]
    Bar = range[0.0 .. 1.0] # float works too
  
  var f:Foo = 42       # Error: cannot convert 42 to Foo = range 1..10(int)
  var p = Positive 22  # Positive and Natural types are pre-defined
[0] - https://nim-lang.org/docs/manual.html#types-subrange-types

There are no comments on this comment yet.