3 ms·
This is my first type hearing about linear types, but my guess is the name comes from the fact that you have to repeatedly “thread” a value through your code to
by ajjenkins 4y ago
This is my first type hearing about linear types, but my guess is the name comes from the fact that you have to repeatedly “thread” a value through your code to keep using it. If you look at the example for Files, you have to pass the outputted file pointer from writeFile as an input value to the next writeFile. So you can picture that one file pointer as linearly threading through you code. And it’s specifically linear because your “thread” can’t “branch”, because that would mean you’re using the same value twice (except an if-statement is kind of a branch, but it’s ok because when the code runs the value will follow a linear path).
But I agree that “linear types” is not a great name. Something like “single use types” would be clearer to me.