News for hackers. Stuff that matters.
Re:Grain: A strongly-typed functional programming language f... by Kinrany on Sunday April 25, 2021 @09:05AM (#26932392)
For unrelated reasons, I wonder how strong Rust's runtime types are. That is, assuming you manage to compile something with undefined behavior, will the program crash immediately?
Re:Grain: A strongly-typed functional programming language f... by tom_mellior on Sunday April 25, 2021 @07:40PM (#26937804)
It won't necessarily crash immediately. Inside unsafe blocks you can invoke undefined behavior by overwriting arbitrary memory locations. The effects of reading that modified memory (including crashes) can become visible much later, long after the unsafe block.
Re:Grain: A strongly-typed functional programming language f... by ithkuil on Sunday April 25, 2021 @09:24AM (#26932509)
Rust undefined behavior can only happen within "unsafe" blocks.

You can read more about what things the programmer has to manually avoid while writing code in "unsafe" code blocks: https://doc.rust-lang.org/reference/behavior-considered-unde...

EDIT: this means that if you stick to safe rust, the type system ensures you cannot have data races (among other things)

Re:Grain: A strongly-typed functional programming language f... by Kinrany on Sunday April 25, 2021 @07:39PM (#26937797)
I do mean the unsafe blocks.