So, Hacklang does not have a new, bizarre type system, where before you can use it, you need to check a variable with a zero value. I wonder if you can achieve something like linear types by statically invoking the order of function calls, and the usual example is to 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()instead of throwing an exception at runtime, it just doesn't compile:
$file_handler = get_file_handler("myfile");
$string = $file_handler->read();
doable?
(OK, maybe a bad example for PHP / Hacklang, since this is not this low level, but you get the idea.)
source
share