title: Linear types in hacklang: Statically forcing an order of function calls
body: <p>So Hacklang is out with a new, fancy type system, where a nullable variable has to be checked before it can be used. What I wonder is, can you achieve something like linear types, statically forcing an order of function calls, the common example being open a file before reading it? In pseudo-code:</p>
  
  <pre><code>$file_handler = get_file_handler("myfile");
  $file_handler-&gt;open();
  $string = $file_handler-&gt;read();
  </code></pre>
  
  <p>Now, <code>$file_handler-&gt;read()</code> without <code>open()</code> would rather than throwing a runtime exception, just not compile:</p>
  
  <pre><code>$file_handler = get_file_handler("myfile");
  $string = $file_handler-&gt;read(); /* Won't compile, must run open() first */
  </code></pre>
  
  <p>Doable?</p>
  
  <p>(OK, maybe bad example for PHP/Hacklang, since it is not this lowlevel, but you get the idea.)</p>