3 ms·
AFAICT the compiler would forbid to use `file` after the `writeString(file)` line, because it has been consumed. You can get something like affine types out of
by nine_k 2y ago
AFAICT the compiler would forbid to use `file` after the `writeString(file)` line, because it has been consumed.
You can get something like affine types out of the linear types constructed this way, by returning new one-time value every time when operations on an object can continue:
let file_1: File := openFile("test.txt");
let file_2 := writeString(file_1, "Hello, world!");
g(file_2);