this post was submitted on 03 Nov 2022
21 points (100.0% liked)
General Programming Discussion
7806 readers
1 users here now
A general programming discussion community.
Rules:
- Be civil.
- Please start discussions that spark conversation
Other communities
Systems
Functional Programming
Also related
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Honestly, I doubt we'll get all the way to pure functional programming, at least not in the next decades. But there is much to learn from FP.
Immutable-by-default is just sane. Algebraic data types offer a more explicit method for nullability and error handling. And higher-order functions for processing lists are so damn convenient, they're basically included in every programming language now.
So, yeah, I think, we'll take tools out of the FP toolbox and forget about some of the horrors of OOP, like massive inheritance chains, getters/setters etc., but ultimately stay on an imperative style of programming.
That will solve most of the pain and then that last step is too hard for the industry to take it.
Which industry?
Programming is more than just writing Yet Another CRUD-backed data-siphoning web app. It's more than supercomputing/high performance computing. It's more than spreadsheets and word processors. It's more than games.
Any one of those fields I mentioned are effectively a completely separate industry from the others. And I haven't even touched the 500kg gorilla of embedded systems that outnumber all of those put together by an order of magnitude or two.
Some software industries (the web stuff, say, or user-facing software like spreadsheets and word processors) will find pure functional or major steps along that path to be useful and an improvement over current techniques. Others (high performance computing, games) will find themselves stepping backward if they go the full-functional route. And that 500kg gorilla I mentioned simply can't use functional programming. (Hell, I don't think there's a pure-functional runtime that fits into any of the kit I work on, not to mention the runtime plus an actual application. I'm willing to be corrected, though: if there's a functional language out there that will let me write non-trivial applications that fit in 256KB code space and 48KB dynamic data space, I'm eager to hear about it!)
However much you think you know about software development, be aware that it's far larger than you think. (This applies to me too. I haven't even glanced at financial or health software's direction, and only have very vague notions of what aerospace systems entail.) And as a result, different tool sets are required for different problem domains. Functional doesn't fit them all.
Depends what you mean by pure-functional. If you mean an ML-family language with lazy evaluation and explicit sequencing of side effects, then probably not. But there are certainly lisps suitable for those constraints. uLisp runs on Arduino Nano microcontrollers with 32 Kbytes of program memory and 2 Kbytes of RAM. lllm is a lispy DSL for writing assembly language.
Yeah, probably also worth pointing out that the original LISP came out in 1958.
A function isn't complex to portray in memory when you're passing it to other functions. It's also just a pointer to where your function's code lives. @ttmrichter@lemmy.ml
Lisp is "functional-enabling" not a functional language. Take a look at the Common Lisp library and you'll see a whole lot of imperative-nature constructs and code in it. Lisp permits (and to a degree supports) functional programming. It does not enforce nor even default to the functional paradigm.
And even in a Lisp you're going to start hitting the boundaries of your kit in the embedded world when you do partial application, closures, and even something as seemingly trivial as using immutable state. You'll wind up fighting the language more often than fighting your problem domain and the result will be counterproductive.
Best of breed for me in embedded space is Ada (with Modula-3 being another decent choice). Lisp's not even in the display hall.