Typestates in Rust (2018)
This line caught my eye.<p>my_file.open();  // Error: this may fail.<p>1) If this can fail, then it should be a compile error to not test the result code.<p>2) IMHO it would be nice if there was something like Python's with statement to correctly close a file.<p><pre><code>    with open(filename, 'r') as f:
        f.read()
    # f.close() invoked automatically here
</code></pre>
This prevents trying to close a file that is not opened.<p>The idea of encoding a state machine into the types seems interesting.