While functional programming is undoubtedly purer (which is a criterion of good) and academically correct (which is another criterion of good), and it's more useful for specifying and reasoning over procedures and abstractions, I agree that it's weak for real-world projects (in spite of considering it a superior programming technique).
That's why I want a good multi-paradigm programming language. Build the skeleton, the I/O and (as much as I hate this word) the glue on an imperative framework, then implement the application logic in a nice, provable, correct functional manner, and share a powerful object system such as Python's across them. This is my vision of how a real-world application in Python's domains should be built.
But sometimes, you don't really have that choice of language. For example, if your application uses Data Science, then you pretty much have to use Python - it's the lingua franca of the Data Science world.
Don't you know? At the Pearly Gates St. Peter's job is to turn away those who can't write a factorial function that doesn't use variables. Being pure is a matter of grave importance for your soul!
Never mind 'purer', how about a definition of 'pure'? In my mind, the purest programming language is the machine code that runs on the bare metal. Everything else is just sugar on top.
It is. It'll always yield better results and be the easiest to modify (which happens both while you work on a project for the first time, and when you maintain it), and the easiest to understand and reason over it once it has been written, because it's as close to perfection as possible (as abstract and generalized as possible, as simple as possible, as minimal as possible).
(as abstract and generalized as possible, as simple as possible, as minimal as possible).
I think that that works against the goal of being "as readable as possible," which is Python's goal. Even now that I know what the Y combinator does, it still makes no sense to me when I read it. Guido similarly has moved reduce into a library, because he thinks it kills readability. And that is the goal. Not speed (try C or C++), not purity (try Haskell), not flexibility (try Lisp), not chunky bacon (try Ruby). All languages are optimized for different things, but you don't seem to want what Python is offering. Which is fine, but try something else, yeah?
I think that that works against the goal of being "as readable as possible,"
Aren't you confusing readability with experience reading? After reading SICP and working with Scheme for a while, I find tail-recursive functions as easy to read and understand than loops (actually, easier in some cases, more difficult in others). I definitely find decorators implemented with closures far easier to read than those implemented as functors (a class with __call__). I find lambda easier to read than def Lulz() [...several lines below...] Lulz. I definitely find closures easier to read than the stunts you have to pull to avoid it. I seem to find every functional programming feature I get used with easy to read once I get used with it.
Pretty often, the impression that imperative code is easier to read is just prejudice and trauma from having suffered a Fotran-derived language. I suffered it myself, but I'm getting cured. And I'd like to ask people who learnt to program with Scheme first what they find easier.
All languages are optimized for different things, but you don't seem to want what Python is offering.
I love what Python is offering! That's why I'm using it. I just want it to be even better by pursuing its goals even better.
If you are being serious than I wanted to point out you just reinforced exactly what I was saying with your first run-on sentence.
Why is purer or academically correct criterions of good? How exactly are you defining 'good'? How are you able to call it 'a superior programming technique' while still admitting it is 'weak for real-world projects'?
Since this is heading in the direction of being a religious argument I am going to go ahead and jump the shark here by saying that your viewpoint is coming off as a form of fundamentalism to me. You are starting with the conclusion (functional == better) and working backwards to fill in the blanks. This is not a sane way to approach problem solving, IMHO.
5
u/Wiseman1024 Nov 11 '08
While functional programming is undoubtedly purer (which is a criterion of good) and academically correct (which is another criterion of good), and it's more useful for specifying and reasoning over procedures and abstractions, I agree that it's weak for real-world projects (in spite of considering it a superior programming technique).
That's why I want a good multi-paradigm programming language. Build the skeleton, the I/O and (as much as I hate this word) the glue on an imperative framework, then implement the application logic in a nice, provable, correct functional manner, and share a powerful object system such as Python's across them. This is my vision of how a real-world application in Python's domains should be built.