Submitted by fchung t3_z7hlb0 in technology
shavetheyaks t1_iy78ycb wrote
Reply to comment by jphamlore in Why Functional Programming Should Be the Future of Software Development by fchung
I hate this article too (all the "examples" they give are exaggerated and abstract, and halfway through it turns into a not-so-subtle ad for their company), but I would argue that having to use goto for those things is a (soft) flaw in the C language.
My understanding of structured programming is that they took uses of goto and built them into the language to make it easier for the compiler/programmer to reason about them. Error handling and loop restarting are structured patterns that could have been added to the language itself.
Those patterns are so few and easy to reason about that I don't think there's any reason to add things like try/catch to C, but I don't think the presence of goto in C code means that goto is necesssary or desireable (except maybe for the crazy context-switching code you'd see in an OS).
Deadmist t1_iy8y9cu wrote
It's been 50 years since C was released. We simply have better options than using goto in modern languages.
shavetheyaks t1_iyagi6f wrote
The problem is that modern languages still don't target C's niche (systems and embedded) as well as C does. So we're stuck with it for those cases until something else comes along.
The only thing I know of that's trying for C's niche is Rust, and it's still not ready for it yet, IMO.
Viewing a single comment thread. View all comments