News for hackers. Stuff that matters.
Re:Helix: A Neovim inspired editor, written in Rust by atoav on Monday October 10, 2022 @03:06AM (#33148613)
Have you checked what that unsafe code does? Unsafe code is not bad per se, there has been quite a bit of discussion about the naming of unsafe and many are of the opinion that it should have better been called something like trustme to clarify that the code must not be necessarily unsafe, just that the borrow checker doesn't fully check here, which for certain core algorithms can be necessary.

As long as the content of those blocks has been carefully checked there is no problem with using unsafe.

Re:Helix: A Neovim inspired editor, written in Rust by p-e-w on Monday October 10, 2022 @03:42AM (#33148812)
> just that the borrow checker doesn't fully check here

That's incorrect. The borrow checker performs the same checks inside `unsafe` blocks as everywhere else.

`unsafe` blocks can perhaps best be summarized as areas of code where memory safety rules are relaxed. The borrow checker deals with ownership, and ownership rules are still fully enforced inside `unsafe` constructs.

Re:Helix: A Neovim inspired editor, written in Rust by funklute on Monday October 10, 2022 @03:31AM (#33148752)
> just that the borrow checker doesn't fully check here, which for certain core algorithms can be necessary

Why is that? Does this imply that there are certain algorithms you simply can't write (efficiently) when using the borrow-checker? (I don't know Rust btw, but have plans to start learning very soon)

Re:Helix: A Neovim inspired editor, written in Rust by sushibowl on Monday October 10, 2022 @05:29AM (#33149438)
Missing some nuance, but that description is not too far off. The ownership/borrowing concept is based on the idea that every piece of data has a single owner. Particularly in cyclical data structures, it's not very clear who should have final ownership over what. This can make graph-like data structures somewhat difficult to express.