Live data from Hacker News

Where FP meets OO

christopherhunt-software.blogspot.com

51–60 of 64 posts

Re: Where FP meets OO

#51
post #45

Alan Kay was inspired by the real world, mostly biology back when psychotropic substances were rather popular. That's were the problems start. The real world systems are: 1) unpredictable - except for those who can forecast the future. 2) Unreliable 3) Slow 4) Uncoordinated - except if you believe someone runs the world. 5) Unmaintainable - just ask someone on human maintenance (drug research etc). 6) Naturally auton…

For point 6, that wasn't Kay but the simula crowd who invented OOP before Kay. FP is like math: it isn't based on biology or natural human thought, but rather the truth of math. OOP is much more fuzzy, you can say things that you can't nescessarily prove are true via biased naming and relating (just like you could say and think as a person). Math is great and useful, but there is a reason we haven't evolved into stra…

[deleted]

Re: Where FP meets OO

#52
post #45

Alan Kay was inspired by the real world, mostly biology back when psychotropic substances were rather popular. That's were the problems start. The real world systems are: 1) unpredictable - except for those who can forecast the future. 2) Unreliable 3) Slow 4) Uncoordinated - except if you believe someone runs the world. 5) Unmaintainable - just ask someone on human maintenance (drug research etc). 6) Naturally auton…

For point 6, that wasn't Kay but the simula crowd who invented OOP before Kay. FP is like math: it isn't based on biology or natural human thought, but rather the truth of math. OOP is much more fuzzy, you can say things that you can't nescessarily prove are true via biased naming and relating (just like you could say and think as a person). Math is great and useful, but there is a reason we haven't evolved into stra…

Well seems that simula OOP was a bit more like java/c++. It was Kay who had the message passing idea, and the smalltalk people still don't consider java/c++/simula-derivatives as true OOP languages because they miss that.

http://c2.com/cgi/wiki?AlanKaysDefinitionOfObjectOriented http://userpage.fu-berlin.de/~ram/pub/pub_jf47ht81Ht/doc_kay...

Re: Where FP meets OO

#53

Earlier quoted context omitted.

> Where is inheritance? Inheritance is just a protocol which specifies what to do with unknown message instead of signaling an error or returning a bottom like in Haskell. Care to explain? Doesn't make any sense to me...

A protocol is like a set of rules. It it specifies, for example, that each object (a closure) has special bindings, which holds references to its class (which is also a closure) and to itself, so it could send a massage to its super or to self. Classes could have its own methods (inner closures). Basically, when you send a message, you have to specify a symbol, that corresponds to a method name, and parameters. The p…

yes, that part makes sense, but in Haskell, an unknown "message" is a compiler error, and bottom represents abnormal termination (e.g exception or even non termination), I don't really understand how that's related to inheritance.

Re: Where FP meets OO

#54

Earlier quoted context omitted.

A protocol is like a set of rules. It it specifies, for example, that each object (a closure) has special bindings, which holds references to its class (which is also a closure) and to itself, so it could send a massage to its super or to self. Classes could have its own methods (inner closures). Basically, when you send a message, you have to specify a symbol, that corresponds to a method name, and parameters. The p…

yes, that part makes sense, but in Haskell, an unknown "message" is a compiler error, and bottom represents abnormal termination (e.g exception or even non termination), I don't really understand how that's related to inheritance.

I am not sure that an unknown message could be caught at compile time, because we don't know everything in advance. I also don't think that static type checking is the only way to program.

In that toy example I should return an error, because '() is a legit value.

Re: Where FP meets OO

#55
post #34

Earlier quoted context omitted.

I'm not claiming it's a solved problem; I'm claiming that the current solutions are lacking. You can take it as standing on the outside and throwing stones, but it's not malicious. I want something better.

Yeah, I know, same deal with type safe database query DSLs, none have hit the mark yet, including M$'s Linq to Sql, Scala's Slick, Haskell's Esqueleto and Opaleye, etc. Seems we're on the brink of a completely type safe distributed stack, but argghingly not quite there. Maybe in another couple of years the computing community will have turned the corner. FWIW, from the outside looking in Haskell seems to be kicking a…

I would be interested in what you think is missing from Opaleye. Of course there is plenty of Postgres functionality that hasn't been ported across yet, but I'm wondering what you think is missing conceptually.

Re: Where FP meets OO

#56
post #52

Earlier quoted context omitted.

For point 6, that wasn't Kay but the simula crowd who invented OOP before Kay. FP is like math: it isn't based on biology or natural human thought, but rather the truth of math. OOP is much more fuzzy, you can say things that you can't nescessarily prove are true via biased naming and relating (just like you could say and think as a person). Math is great and useful, but there is a reason we haven't evolved into stra…

Well seems that simula OOP was a bit more like java/c++. It was Kay who had the message passing idea, and the smalltalk people still don't consider java/c++/simula-derivatives as true OOP languages because they miss that. http://c2.com/cgi/wiki?AlanKaysDefinitionOfObjectOriented http://userpage.fu-berlin.de/~ram/pub/pub_jf47ht81Ht/doc_kay...

I think you have it backwards: OOP in Simula was more bizarre since all objects basically ran as co-routines. It isn't until Smalltalk where we get the non-autonomous objects that we are familiar with today.

Re: Where FP meets OO

#57
post #41
post #20

Earlier quoted context omitted.

I don't agree with that. Naming things and communicating well is something you have to do in every programming paradigm and is not specific to OOP. IMO, if you want to see what OOP is really about you should focus on its unique features: inheritance, subtype polymorphism, etc.

To me, OOP is, first and foremost, about messages. Everything else is negotiable.

Messages, communication, aren't they same thing, no? I don't agree with Alan Kay on this point; or perhaps I don't understand it correctly (it is just one sentence, he never really elaborates on it anywhere as far as I can find, the best I have found is [1]).

[1] http://c2.com/cgi/wiki?AlanKayOnMessaging

Re: Where FP meets OO

#58
post #9
post #7

Earlier quoted context omitted.

C# and F# are different languages.. Last I checked you could not mix the two easily [0] [0]: http://stackoverflow.com/questions/14280001/why-cant-we-use-...

I think the poster means that c# has many functional features and F#, while being functional language at heart has lots of OO features integrated in it. PS And the linked question only describes the limitations of Visual Studio where you can have only one language in a given project.

> I think the poster means that c# has many functional features

Yeah just like C++ or Java now have "functional features". That doesn't make them functional languages, they don't promote functional programming to the extent that Scala does.

Aside from that, their type systems are much too unexpressive to allow for the style functional programmers are used to, not to mention they promote mutability.

Re: Where FP meets OO

#59
post #4

"Scala is the only language that I know of that marries the world of FP and OO" You can do that in C#/F# too. There's nothing special about Scala from this point of view.

Nope. Scala allows for and promotes for functional programming with higher order functions all over the place, its more powerful type system, immutability, practices, standard library, and much more.

Having lambdas makes you about as functional as C++ these days.

Functional/non-functional is a fuzzy distinction but C# is definitely not a functional language.

Re: Where FP meets OO

#60

Scala is the only language that I know of that marries the world of FP and OO and thus does not need to “throw the baby out with the bathwater”. Have you had chance to try Swift yet. It could do with Tail Call Optimisation but I do think it can already be used for functional programming.

If it doesn't have tail call optimizations then it's about as far away from functional as you can get. They're essential for basic functional abstraction.
Post reply on HN