Prologue: Full-Stack Web Framework Written in Nim
I've been writing an interpreter with Nim and overall the language is really good.<p>One feature that I'm excited for is DrNim[1]. It's not distributed with the stable version just yet (you have to compile it yourself, but that's very straightforward), but it's supposed to bring refinement types to Nim. These allow you to write things like:<p><pre><code>    proc safeDivide(a: int, b: int): float {.requires b > 0.} =
        a / b
</code></pre>
and DrNim will check at compile-time that all code paths lead to `b` being greater than 0, e.g.:<p><pre><code>    var x = stdin.readLine.parseInt
    safeDivide(1, x) # DrNim will error at compile-time 
    var y = stdin.readLine.parseInt
    if y > 20:
       # no error since DrNim (using Z3) can
       # prove that y is always greater than 0 here
       safeDivide(1, y)
</code></pre>
[1]: <a href="https://nim-lang.org/docs/drnim.html" rel="nofollow">https://nim-lang.org/docs/drnim.html</a>