4 ms·
That is true, but on the other hand, Wuffles allows safe unchecked array indexing, which is a very hard problem that Rust doesn't attempt to tackle--in part bec
by Jweb_Guru 6y ago
That is true, but on the other hand, Wuffles allows safe unchecked array indexing, which is a very hard problem that Rust doesn't attempt to tackle--in part because it spends most of its complexity budget on the borrow checker! I for one would be extremely interested in using Wuffles in the inner loop of many routines I currently write in Rust which are performance critical, and for which I know bounds checking is hurting performance (sometimes in ways it's hard to convince LLVM to remove), but for which I can't justify the use of `unsafe`. I would particularly love it as an embedded language, rather than one needing a full-blown application.
- Gaelan 6y ago> I would particularly love it as an embedded language, rather than one needing a full-blown application. Given the existence of [0], I imagine this is doable. [0]: https://docs.rs/inline-python/0.6.0/inline_python/ https://docs.rs/inline-python/0.6.0/inline_python/
- mckirk 6y agoThat inline Python is the closest thing to black magic I've seen in a while. I guess I have to find an excuse to play around with Rust some time soon, it seems like such a cool ecosystem.
- iudqnolq 6y agoIf you like that sort of thing you'll enjoy following the creater on twitter. Here's another of her creations > Did you know you can just fork() the @rustlang compiler from your proc_macro? > Unfortunately rustc is multithreaded and fork() only forks one thread. We'll just assume the other threads weren't doing anything important. > In today's rustc, this means we're only missing the main thread in the fork. But that one was only going to call exit() after joining our thread anyway, so not very important. It just means the process always exits with a success status. So instead we grep the output for "error". https://mobile.twitter.com/m_ou_se/status/1368844186607357957 https://mobile.twitter.com/m_ou_se/status/136884418660735795...
- volta83 6y agoGenerational indices allow safe unchecked array indexing in Rust. There are many papers that cover how to do this, starting with Alexis Beissegners thesis, up to the latest Rust belt project paper on GhostCell. There are also many libraries implementing this, so that you don't have to do it yourself. In practice, however, like the Wuffs project says, most code doesn't care about this. You only need this for very specific types of code, but if you need it, you have it in Rust. --- On the other hand, I've asked above what happens if you try to open a png that doesn't fit in RAM, like one of those huge space photos that are >1 Tb in size. Firefox just handles these fine, rendering only the part of the picture that you are looking at, using level of detail, etc. This Wuff example assumes that you have enough RAM to decode the whole image at once, which is something that widely-used libraries are not allowed to assume, because they must support from embedded systems with little RAM up to absurdly huge images of our universe.