Its a style of programming C was built for, and not many other languages.
It's almost the opposite of good style elsewhere: aggressively procedural code with an elegant boundary.
I'd say it would be a good lesson to many who are down the or pure functional rabbit holes: perhaps there is some other sense of modularity that goes missing when "single purpose" is applied too narrowly.
> Its a style of programming C was built for, and not many other languages.
Rust seems well adapted for it:
> (1) Small number of functions, perhaps even as little as one.
One annoyance with that kind of stuff is that you'll get many small dependencies rather than a few big ones. Having a simple and easy way to acquire & maintain these dependencies is useful, and Cargo provides that.
> (2) No dynamic memory allocations.
> (3) No input or output.
That's pretty much what a #[no_std] (libcore-only) library is[0].
> (4) Define at most one structure, and perhaps even none.
That's the bit I disagree most about, but if that's what you want the language won't stop you.
[0] unless it's requires nightly and uses alloc directly but that's not too common right now I think
It's almost the opposite of good style elsewhere: aggressively procedural code with an elegant boundary.
I'd say it would be a good lesson to many who are down the or pure functional rabbit holes: perhaps there is some other sense of modularity that goes missing when "single purpose" is applied too narrowly.