Re:Erlang: ‘Let It Crash’ under attack
by trh0awayman on Wednesday November 30, 2022 @03:07AM
(#33798183)
Isn't the bogus code trivially caught by linear type languages like Austral? Maybe we need to move past urBEAM and into futureBEAM
[ Parent
| on HN ]
Re:Erlang: ‘Let It Crash’ under attack
by nextaccountic on Wednesday November 30, 2022 @09:09AM
(#33800955)
Yes. Also by the typestate pattern: have open and closed files have different types, and write be implemented only for open files
Re:Erlang: ‘Let It Crash’ under attack
by javcasas on Wednesday November 30, 2022 @10:25AM
(#33801989)
Nothing short of linear types prevent you from saving the open file descriptor to a variable, closing the file, then using the open file descriptor variable again.
Re:Erlang: ‘Let It Crash’ under attack
by nextaccountic on Thursday December 01, 2022 @01:18AM
(#33812974)
That's true! It's not an "also", you use both linear/affine types plus the typestate pattern
For the curious, it works like this in Rust http://cliffle.com/blog/rust-typestate/ https://willcrichton.net/rust-api-type-patterns/typestate.ht...
Or rather, typestate itself needs either linear/affine types or a similar mechanism to make sure that when you are in the "closed" state you can't access methods from the "open" state, and vice-versa. (now, there are languages that implement typestate as a language feature rather than a design pattern, but I don't know how they work)