Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Helix is built from the ground up around Tree-Sitter and LSP.

Sadly, that achievement is compromised by having to call into unsafe code.



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.


> 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.


> 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)


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.


Vim, being written in C, is 100% "unsafe code", so this doesn't bother me much.


Unsafe code is not bad code.


as opposed to c or c++ which is effectively unsafe EVERYWHERE?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: