News for hackers. Stuff that matters.
Re:C-rusted: The Advantages of Rust, in C, without the Disad... by EamonnMR on Monday February 20, 2023 @12:24AM (#34865196)
This seems more like the disadvantages rust, with the disadvantages of C. 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.
Re:C-rusted: The Advantages of Rust, in C, without the Disad... by faisal_ksa on Monday February 20, 2023 @01:26AM (#34865551)
Maybe Zig[1]?

[1]: https://ziglang.org/

Re:C-rusted: The Advantages of Rust, in C, without the Disad... by EamonnMR on Monday February 20, 2023 @11:03AM (#34869375)
I'm still waiting on a Zig book.
Re:C-rusted: The Advantages of Rust, in C, without the Disad... by JoshTriplett on Monday February 20, 2023 @01:56AM (#34865714)
> 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?

Re:C-rusted: The Advantages of Rust, in C, without the Disad... by gpm on Monday February 20, 2023 @03:19AM (#34866160)
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"?

Re:C-rusted: The Advantages of Rust, in C, without the Disad... by pcwalton on Monday February 20, 2023 @04:29AM (#34866539)
I really want -> in Rust too (or perhaps .*). I don't see why such a thing would be controversial.
Re:C-rusted: The Advantages of Rust, in C, without the Disad... by JoshTriplett on Monday February 20, 2023 @05:17PM (#34873700)
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.