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

> What I really want is the footguns of C with the ergonomic modern veneer of Rust's nicer syntax, built-in types, control structures etc

Would unsafe Rust work for that, or is there a C footgun you need that that doesn't provide?



Using unsafe rust to try and write "rust without safety" doesn't work particularly well IMHO. Arguably that's a feature, unsafe rust is meant for implementing things that you couldn't implement in safe rust, not meant for just wholesale avoiding the borrow checker and going on with your life.

The biggest thing that is missing is a `->` operator (or the safe-rust solution of auto dereferencing with `.`, which is disabled for raw ptrs). Having to write (*foo).bar all over the place is not a good experience.

The second biggest thing that is missing is a footgun. Auto casting integer types all over the place. To different integer types. To offsets for pointers. Etc.

Disclaimer: It's been a few years since I really dug into the unsafe side of the language, maybe things have "improved"?


I really want -> in Rust too (or perhaps .*). I don't see why such a thing would be controversial.


I'm interested in seeing something like that as well. The controversy is entirely "should we spend syntax space on that" and "if so, which part of the syntax space".

There are some proposals going around that would solve that problem.




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

Search: