4 ms·
> Imperative programming languages (like C and JavaScript) don't generally impose any discipline on the users. I think this view disrespects history a little.
by fnrslvr 7y ago
> Imperative programming languages (like C and JavaScript) don't generally impose any discipline on the users.
I think this view disrespects history a little. C was one of the earliest languages to be conceived upon a foundation of structured programming principles, i.e. block structure, sequence/selection/repetition, subroutining. (Okay the language still has goto, hopefully we can agree to not make a big deal out of that.) The kind of discipline proposed by structured programming was far from universally well-received at the time, and I think it's fair to say that it lead to huge improvements in the quality of codebases everywhere, and is one of the great successes of programming language thinking of the '70s.
C is also statically typed. It's obviously easy to blow all sorts of holes in C's type system, but if you'd go so far as to say that C's types impose no discipline at all, I'd ask you to try teaching C to a room full of compsci students who have been raised on something like Python.
- pjmlp 7y agoKind of true, however C's type system is very weak versus what 60's Algol and PL/I variants were capable of.
- civility 7y ago> I think this view disrespects history a little. I love C, but I'm hard pressed to think of any language other than assembly which is more willing to get out your way if you so much as nudge in an undisciplined direction. C certainly does not impose much discipline on programmers, but it allows them to bring some if they walk the line. > Okay the language still has goto, hopefully we can agree to not make a big deal out of that. > It's obviously easy to blow all sorts of holes in C's type system Yes, I'm willing to politely ignore evidence which refutes your point. I mean you were kind enough to make my case for me. :-) > I'd ask you to try teaching C to a room full of compsci students who have been raised on something like Python. Dynamic vs static typing seems orthogonal to what we're talking about here, but maybe I'd have to think about that more. Python just waits to catch your type errors until runtime. Comparing that to JavaScript in a browser which silently ignores your errors (or happily performs crazy type conversions), Python seems disciplined in comparison.