News for hackers. Stuff that matters.
Re:Hecto: Build your own text editor in Rust by nicoburns on Tuesday January 19, 2021 @12:14AM (#25830237)
Is there a way to make it safe-by-default, such that I can't accidentally stray beyond what the compiler can prove safe?
Re:Hecto: Build your own text editor in Rust by mhh__ on Tuesday January 19, 2021 @01:01AM (#25830501)
There was a proposal to do just that in our DIP (D improvement proposal) pipeline that nearly made it but it (probably correctly) received enormous backlash.

However, if you use @safe (that's the attribute) the compiler will hard-error if you call any code that you use that isn't explicitly also either @safe or @trusted.

There is also DIP1000 and DIP1021 which both loosen @safe semantics to perform semantic analysis to allow safe memory behaviour (A small borrow checker in effect, this will hopefully be bigger soon).

Re:Hecto: Build your own text editor in Rust by cle on Tuesday January 19, 2021 @12:48AM (#25830424)
Try accessing a struct property that isn't in the declaration, or accessing a value after it has been freed (out of scope). You'll get a compile error.

D has lots of memory safety features. It is not the same set of features as Rust. It's wildly incorrect to suggest that Rust has a monopoly on memory safety.