I wonder if that last bit was as unfashionable a statement when he made it as it would be now.
I wonder if that last bit was as unfashionable a statement when he made it as it would be now.
The vast majority of the world's programs are written in procedural languages, and that situation does not look likely to change for the foreseeable future.
It's certainly not an uncommon preference, but it's an unfashionable statement, at least among the intellectual circles that programming language designers with PhDs (or almost-PhDs!) tend to belong to. That's why I was interested to read it there. I've long had a joke, when asked if I prefer FP or OO, to say "I prefer imperative programming". It's funny because of that fashion. What I was wondering was whether said fashion was in place by the late 90s when dmr apparently wrote this, in which case maybe there was a trace of a joke there as well.
Edit: having read more of the OP, it seems to me deliciously apropos that his dissertation involved replacing recursive logic with loops.
Not saying you can’t, say, pass around closures in Excel but it’s far from natural. Whilst spreadsheets always remind me, more than anything, of the Prolog I took in college, and not the Lisp or ML.
No, its uses the Excel formula language, which isn't the same as VBA (nor is it a subset of VBA; Excel formula language expressions generally aren't valid VBA.)
It is not an imperative language: the user does not tell the computer which order in which to carry out computations. It is not procedural: there is no notion writing of procedures within its cells. It is not functional: while there are built-in functions users cannot write their own in the same way.
It's been a while since I've used Excel, but I thought you could write custom methods using VBA that could be called in a given cell.
The nearest Excel equivalent would be constructing a formula string for later evaluation, which is far from the same thing. If you wanted to perform lambda calculus in Excel you’d end up implementing your own functional programming language in VBA. Have fun with that :-)
Also 40 years ago we had what? LISP as is commonly used is not an FP language. ML was nice but there wasn't much FP done in ML either.
The advancements to make FP practical, like good garbage collectors, laziness, monads, good persistent data structures, are newer.
I have published at ICFP and in the JFP, and understand garbage collectors, laziness, monads, good persistent data structures very well. Yet, I prefer CBV to lazy evaluation, I prefer full unrestricted support for imperative programming, I don't think Haskell approach to effects by monads is ideal (I prefer Scala's giving you the option to tame effects by monads). There is a reason why, despite near half a century since Backus' "Can programming be liberated from the von Neumann style?", CUDA dominates HPC, C++/C (and Rust) dominate mainstream infrastructure programming, Go took the cloud world by storm, ML is dominated by Python, front-end is dominated by Javascript/Typescript, hardware design is dominated by Verilog, and business computing (for lack of a better term) is dominated by Java/C#. I really don't think the reason is that everybody is too uneducated to realise the benefits of Haskell.
The move to functional-style code the last many years seems a bit silly to me. Even C++ has been moving in a well-known trend of "no raw loops" in favor of the algorithms header in STL. I don't find there is a significant reason to abandon easy code most of the time. If you actually need to use the functional paradigm to swap out behavior in a polymorphic fashion using functions instead of inheritance, for example, then great.
Sometimes they're are able to find a good simple solution to a hard problem but then feel bad for not using complex patterns, some popular external dependency, or for the lack of ability of giving it a complicated name.
The con argument: we have enough memory and cpu now that functional languages are more practical than they ever were, which may help them be more prêt-à-porter fashion than the haute couture of a geekish peacock tail or springbok leap.
[1] I'm usually asking questions about long-dead endian-style controversies (cue the compromise of arrays starting at 0,5), and it's been nice to hear many of the people involved recommending the work of their opposites. Folk history seems to ascribe more dogmatic attitudes to the people who lived through technical controversies than they actually have.
Another lesson learned: when I try to tease out chains of influences, a not uncommon response is "I wish I'd been that clever, really it was just hacked together."
Thanks to Moore's Law, functional programming is no longer just for the mainframe, but can now be used for normal programs on standard platforms. If more people choose functional now just because they like the style[1], then it could be that procedural would be becoming less fashionable[2] over time.
[1] instead of before, when "wearing the hair shirt" of functional programming could be seen as declaring oneself a strong enough hacker that one could hack despite all the practical drawbacks.
(compare "Honest Costly Signal" in the context of https://news.ycombinator.com/item?id=23570975 )
[2] in the mass fashion vs class fashion sense.
(compare https://news.ycombinator.com/item?id=23560291 . I doubt it's controversial to say functional has always been on the Joycean side.)
For the 80s and much of the 90s Ritchie's view seems obviously dominant, in no small part due to his own work in making extremely "usable" tools for procedural programming.
CPL, IIRC, actually had an outer-functional semantics, and one would escape to "value of" blocks to do procedural stuff (which was necessary in inner code due to the pitifully small machines of the day).
Writing bootstrap compilers in GPM must've been very similar to working in a lazy functional language.
See also https://en.wikipedia.org/wiki/PAL_(programming_language)
(Emphasis, mine). I suspect that he understood functional languages quite well.
He just didn't like them.
I like some aspects of FP, but there are other aspects that I don't like.
My own development style is a ghastly chimera of techniques, technologies and jargon that coagulate into a disgusting bouillabaisse that makes everyone go "tsk, tsk," but that always seems to work quite well, is of extremely high quality, easy to understand, and results in a great deal of ship.
I am...impure. All zealots hate me.
Care to enumerate? Asking because I feel the same: I really enjoy immutability, first class functions, map/filter/reduce, Option<T> and powerful types (I dislike: currying, point-free, monads), but at the same time I feel more at home doing that in imperative-ish languages like C#, JS/TS and Rust where I can have guard ifs and the odd mutation here and there. Wondering if anyone else is the same.
Don't worry then, that's fine, you just dislike Haskell.
I personally really like functional programming but can't stand Haskell. The style favoured by the community is optimised to be the most impenetrable possible.
You should try Ocaml. The preferred style favours piping to point-free and uses monads sparingly. Currying is everywhere but copious use of named arguments tends to make things simpler.
My biggest gripe with it is not so much the language itself but the culture: it favours bloated and pompous solutions much in the same way Java/Spring does. Monad Lifting, Lenses, Aspects and FactoryFactories occupy the same space in my head.
I guess I just prefer both the simple side of functional and the simple side of imperative.
I definitely have to give OCaml a try.
My only gripe with them is that there seems to be a culture of having zero type annotations (due to HM), which can make reading other people's code difficult.
I don't think that's quite true.
Ocaml has plenty of advanced features (the module system, GADT, structural typing in the object system) but the community relationship with them is very different than how the Haskell community uses the language. For the most part, the Ocaml community tends to dislike gratuitous complexity and be non dogmatic (I fondly remember a lens library announcement on which the top comment could be boiled down to "just use mutations").
> My only gripe with them is that there seems to be a culture of having zero type annotations (due to HM), which can make reading other people's code difficult.
Interfaces tend to be annotated (mli files) but usually people rely on the tooling to know types inside files. Merlin is a blessing. It is a very fast type-checker which keeps working on incorrect files.
I should put some more time in with OCaml, Merlin sounds nice.
But I also like state, polymorphism and identity.
My familiarity with FP tends to be around "Hey! I like this Swift feature! Where did it come from?"
It's the part where we clump together functions to make a single, rather powerful function that is, in essence, a rabbithole.
ChrisMarshallNY: I suspect that he understood functional languages quite well. He just didn't like them.
Your statement doesn't follow from Ritchie's words that you quoted. Preference of A over B does not have the logical consequence that B is disliked. It doesn't even imply that A is intensely liked.
Personally, I prefer Haskell or some functional Python at times, since that solves certain problems well. But, we have a lot more computing resources than existed in the past. I guess it could be possible that he enjoyed the functional paradigm, but pragmatically created a procedural language, given the hardware constraints.
It's a functional language.
Always has been.
Though C programming is usually about effects, effects occur in expressions which usually return a value except in cases when their type is "void" (which was a later introduction into C, possibly from C++).
C even has an if/then conditional that yields a value, the ternary operator x ? y : z, which is a more strongly typed version of (if x y z).