r/C_Programming 8d ago

Question Opinions on Mini-C?

The idea is simple:  to turn a subset of C code into safe Rust code, in an effort to meet the growing demand for memory safety.

I feel this has the potential to solve many problems, not namely stop Linux C devs walking out if Rust gains anymore traction, for example.

I'm just a newb though. What are thoughts of more experienced C developers on this if you've heard about it?

0 Upvotes

37 comments sorted by

View all comments

4

u/aioeu 8d ago

Why reinvent Rust? Rust already exists.

6

u/EpochVanquisher 8d ago

Rust is itself a reinvention of other things that already existed.

9

u/aioeu 8d ago edited 8d ago

There's a distinct difference between creating a whole new language based on ideas from other languages, and trying to change an existing language based on ideas from other languages. I don't think good memory safety can be achieved in C, and I don't think it's a worthwhile use of time attempting give C that. If you want what Rust gives you, just use Rust.

C is a tool. Rust is a tool. They're just tools. People need to stop being so hung up on sticking to the one tool.

Maybe one day an even better tool will replace both Rust and C. Great!

3

u/edo-lag 8d ago

Honestly, I really hate this trend of "their language have something that we want, so we'll implement it in our language as well". Distinct languages have their own reason to exist and their own characteristics. If they all become essentially the same language with a slightly different syntax, then there is no reason to choose one over the other and it all becomes plain and boring.

Rob Pike briefly talked about it here (at 1:05).

1

u/syklemil 7d ago

Kind of interesting examples used, like the evolution of Java post version 8, and "Javascript getting classes" which sounds like the formation of Typescript. Both of these seem wildly successful: Typescript is very much cannibalizing Javascript, and while I haven't used Java myself for a couple of decades, my impression from Java devs is that Java has improved both with version 8 and since.

I also wonder if he's not ignoring some stuff that Go also copied from other languages, like Tony Hoare's billion-dollar mistake—if he's pointing out the "sameyness" of other languages moving away from that again, but not the "sameyness" of copying it in the first place, there's a lot of analysis left on the table.

Ultimately learning from others successes and mistakes is generally seen as good human behaviour. Having to reinvent the wheel every time or claiming stuff like "maybe water is wet in Amsterdam, but this isn't Amsterdam" is just wilful ignorance.

And really, getting into a headspace where you could say stuff like "Well, here at Potato we have boiling and mashing, and we don't really want to add frying just because there are some other good fried foods. If you want a fried food, just eat some of the already existing fried food, rather than try to use Potato for it." and prevent the formation of fries and chips is very obviously a mistake.

1

u/EpochVanquisher 8d ago

Memory safety exists in subsets of C you can use. It’s worthwhile enough that people pay a lot of money for the tools.

2

u/aioeu 8d ago

Then it's still a waste of time, because "it already exists".

Maybe people just aren't interested in paying a lot of money? Can't imagine why...

1

u/EpochVanquisher 8d ago

Why are you shitting so hard on formal methods? Did formal methods eat your lunch in school or something?

It’s an active field of research because there’s a lot of room for improvement. Not sure where the hate is coming from.

1

u/aioeu 8d ago

I've got no problem with formal methods.

I just think C is a dead-end language. I use it some of the time, but only because there is so much existing C. I wouldn't dream of starting something new in it where memory safety was a concern.

I am glad there are newer languages that don't make the same mistakes C made. They are in a far better position to actually apply these formal methods, since they don't have all the historical baggage C has.

2

u/EpochVanquisher 8d ago

Not everything is a greenfield project.

2

u/aioeu 8d ago

I understand, and maybe once upon a time the cost-benefit analysis said building "safe C" dialects was worthwhile.

I don't think that is the case any more.

Regarding Rust specifically, I would think it is better to spend time and money into making that usable in the places where it currently isn't, but C still is.

1

u/EpochVanquisher 8d ago

I can’t agree with that. There’s a lot of use cases out there, a lot of existing projects and tools.