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:
$file_handler = get_file_handler("myfile");
$file_handler->open();
$string = $file_handler->read();
Now, $file_handler->read()
without open()
would rather than throwing a runtime exception, just not compile:
$file_handler = get_file_handler("myfile");
$string = $file_handler->read(); /* Won't compile, must run open() first */
Doable?
(OK, maybe bad example for PHP/Hacklang, since it is not this lowlevel, but you get the idea.)