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.
Re:Helix: A Neovim inspired editor, written in Rust
by p-e-w on Monday October 10, 2022 @03:07AM
(#33148618)
Vim, being written in C, is 100% "unsafe code", so this doesn't bother me much.
Re:Helix: A Neovim inspired editor, written in Rust
by tmdh on Monday October 10, 2022 @02:49AM
(#33148530)
Unsafe code is not bad code.
Re:Helix: A Neovim inspired editor, written in Rust
by cultofmetatron on Tuesday October 11, 2022 @10:07AM
(#33163535)
as opposed to c or c++ which is effectively unsafe EVERYWHERE?
Sadly, that achievement is compromised by having to call into unsafe code.