r/functionalprogramming • u/Lubbadubdub • Sep 06 '17
Python Using Python... Struggling with inconsistency...
I'm mainly working with Python at the moment. Most people in my company are using oop, which is kinda "natural" given the choice of the language. In general, I don't like oop. I prefer simple solutions to complex ones when they can solve the same thing and oop adds one layer of abstraction to functions. I value consistency and explicity. I hate it that in Python sometimes you call by reference and sometimes by value and there's no apparent model behind it. Most people are using oop coz they dont care as much about which paradigm to use and it's always easier to argue for oop since "everything is an object anyway" (which is not entirely true and how is that a valid argument..). Is there a way to be more "functional" with Python? Are there good argument against using oop? Or maybe I should just give up and go with the flow...
View all comments
Show parent comment
1
u/ws-ilazki Sep 09 '17
You might like Coconut (I linked to it in another comment) then. Python superset with some ML-ish functional leanings, so you can use all the libraries and fall back to normal Python code whenever it's convenient, but with nicer FP as well.
I get why they're making a language like that, but it's just not for me, and Pike's a terrible spokesperson for anything. If you think that stuff's bad, you should look into his opinions on syntax highlighting, where he compares people using it to children that need to grow up. I'm not joking, or even exaggerating, with this. :/
As for Haskell, I agree. It's a nice language, but a bit too academic for my taste. I get along better with other ML-family languages like F# or OCaml, if I go that route, though I still tend to prefer lisps, like Racket and Clojure.
Oh, of course. I didn't mean that you have to dislike programming to want to use Python; I meant that it's a language that's well-suited to people that just need to get a result and don't care at all about the programming required to do it. They're the types that need enforced indentation rules and other aspects of Python's rigidity, because they're non-programmers that occasionally need a program, rather than programmers.
I actually have Pharo installed, spent a little time experimenting with it. I didn't go into enough depth to have a strong opinion, but its OOP seemed fine as well. As with Ruby, the focus on the message passing instead of the objects makes more of a difference than one might initially think.
Another cool thing is how the whole thing is image-based. You can see sort of what Java was trying to emulate with its classpath- and object- based (rather than filesystem and file based) JVM design, and it's honestly quite interesting. Sort of related, there's a Clojurescript IDE called Nightlight that is somewhat like the Smalltalk design. It's an IDE that runs as part of the CLJS project itself, for that extra bit of interactivity with the project.