Hacker News new | ask | show | jobs
by DannyBee 1198 days ago
It is also unlikely, being a GPU based terminal, that it is written without lots of unsafe memory munging and other fun things, since the underlying API's are still C/C++, and even if they aren't, interacting with GPUs and other hardware is just hard sometimes if they haven't been built thinking of your programming of language. There is of course, a difference between wrapping C apis and them being automatically unsafe, and using lots of unsafe rust like memory transmutation/etc.

In the case of wezterm, a quick glance shows that not only is this correct (lots of unsafe rust, even beyond the normal use of wrapped functions), there is also not a lot of documentation about what the safety conditions of the various unsafe code is.

(which is the usual good practice in handling this sort of thing).

So to your point, saying it's "written in rust" doesn't matter here.

1 comments

> since the underlying API's are still C/C++,

If the use of GPUs is via CUDA, there are my wrappers [1] which are RAII/CADRe, and therefore less unsafe. And on the Rust side - don't you need a bunch of unsafe code in the library enabling GPU support?

[1] : https://github.com/eyalroz/cuda-api-wrappers/

You do, but people here really don't like to admit the rust ecosystem is like that. There is plenty of code that is infinitely better and safer than the equivalent C++ would ever be.

There is lots of "bad" unsafe code that is much worse, and over time, they will have just as much trouble trying to handle this overall as C++ does.

(and no the ability to say you don't want unsafe transitive crates doesn't fix anything)