Live data from Hacker News

Where FP meets OO

christopherhunt-software.blogspot.com

21–30 of 64 posts

Re: Where FP meets OO

#21
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.

OCaml was doing that before any of them.

Although I find it interesting how Ocamlers only rarely reach for the OOP bits of the language. I think that this is in part due to the powerful module system that language has.

Re: Where FP meets OO

#22
post #10

I'm not sure that OO-ness is a desired property. Alexander Stepanov, original creator of the STL: "I find OOP technically unsound. It attempts to decompose the world in terms of interfaces that vary on a single type. To deal with the real problems you need multisorted algebras - families of interfaces that span multiple types. I find OOP philosophically unsound. It claims that everything is an object. Even if it is t…

"You do not start with axioms - you start with proofs. Only when you have found a bunch of related proofs, can you come up with axioms. You end with axioms."

Um, what? You have no FACTS to do proofs with without axioms; they are the fundamental statements one assumes to be true to define a logical system.

Somebody who insists that they need "multisorted algebras" while misunderstanding a fundamental definition in mathematical logic is exceptionally confused...

Re: Where FP meets OO

#23
post #13

While I'm reasonably open-minded about using some parts of OO at higher levels of organization (or at least just genuine modules), I'm not sure Akka is the right place to land there. Functions which are just typed as `a -> ()` have lost (or hidden) all their interesting structure.

Certainly Haskell, for example, is one of the few languages richly endowed with a non-existent module system, but I personally don't know of a distributed computing environment that does preserve types across machine boundaries in any language. I must be missing something, please enlighten.

If type preservation in distributed computing was a trivial engineering problem it would have already been solved and widely used. As it stands Akka is enjoying fairly widespread enterprise adoption in the distributed computing market, untyped-ness notwithstanding.

Interestingly, as saryant points out, Akka 3.0 apparently will be typed, although I was under the impression that the typed actor project was experimental/a long way off/not a sure thing. Guess things have changed for the better...

Re: Where FP meets OO

#24
post #22
post #10

I'm not sure that OO-ness is a desired property. Alexander Stepanov, original creator of the STL: "I find OOP technically unsound. It attempts to decompose the world in terms of interfaces that vary on a single type. To deal with the real problems you need multisorted algebras - families of interfaces that span multiple types. I find OOP philosophically unsound. It claims that everything is an object. Even if it is t…

"You do not start with axioms - you start with proofs. Only when you have found a bunch of related proofs, can you come up with axioms. You end with axioms." Um, what? You have no FACTS to do proofs with without axioms; they are the fundamental statements one assumes to be true to define a logical system. Somebody who insists that they need "multisorted algebras" while misunderstanding a fundamental definition in mat…

I interpreted this to be a top down vs bottom up argument.

In mathematics, we certainly have ZFC as an axiom system now, but mathematics was performed for thousands of years without a "stable" axiomatic base. For example, calculus was developed before the axiomatic delta-epsilon definition for limits was created. The math was developed first, and it was only after the fact that mathematicians went back and set the theory on a stable theoretical footing.

Therefore, I believe Stepanov suggests a bottom up approach: You write an algorithm that performs your work first, and then once you have that, you can refactor the code into classes that encapsulate the various parts of your existing algorithm.

Re: Where FP meets OO

#25
post #13

While I'm reasonably open-minded about using some parts of OO at higher levels of organization (or at least just genuine modules), I'm not sure Akka is the right place to land there. Functions which are just typed as `a -> ()` have lost (or hidden) all their interesting structure.

Certainly Haskell, for example, is one of the few languages richly endowed with a non-existent module system, but I personally don't know of a distributed computing environment that does preserve types across machine boundaries in any language. I must be missing something, please enlighten. If type preservation in distributed computing was a trivial engineering problem it would have already been solved and widely use…

I don't think the typed actors in 3.0 are related to the old typed actors feature. It's still in a state of flux but there's a very preliminary preview in Roland Kuhn's github repo.

Re: Where FP meets OO

#26
post #18

Am I the only one who finds the goalposts gave moved for FP? it used to be lambdas/lexical closures that were the big must-have FP feature, then it was immutability. Now that we're seeing traditionally-OO languages sport a raft of immutable types and good support for lexical closures, now it's all about higher-kinded-types. For a while, the big feature was homoiconicity and tail-call-optimization until lisp fell out…

Functional Programming is just composing a program with pure functions, nothing else.

Immutability and closures are required for that, because mutability may break homoiconicity (which is required for purity), and lack of closures means you can't pass state around.

Higher-kinded types are very useful for helping with lots of functional abstractions, but they are a type system feature and have nothing to do with FP. If someone claims that, this person doesn't understand FP or type systems.

OCaml and Standard ML are two examples of languages without higher kinded types but are just as good as Haskell for FP.

(Although they have a powerful module system to compensate for that).

Re: Where FP meets OO

#28
post #22
post #10

I'm not sure that OO-ness is a desired property. Alexander Stepanov, original creator of the STL: "I find OOP technically unsound. It attempts to decompose the world in terms of interfaces that vary on a single type. To deal with the real problems you need multisorted algebras - families of interfaces that span multiple types. I find OOP philosophically unsound. It claims that everything is an object. Even if it is t…

"You do not start with axioms - you start with proofs. Only when you have found a bunch of related proofs, can you come up with axioms. You end with axioms." Um, what? You have no FACTS to do proofs with without axioms; they are the fundamental statements one assumes to be true to define a logical system. Somebody who insists that they need "multisorted algebras" while misunderstanding a fundamental definition in mat…

The axioms were found much much later than a lot of the work had already been done. When Euclid wrote down his list of axioms do you think he was laying the ground for work yet to be done? No, the axioms were the synthesis he came up with by observing the work that had been done before by others.

Re: Where FP meets OO

#29
post #10

I'm not sure that OO-ness is a desired property. Alexander Stepanov, original creator of the STL: "I find OOP technically unsound. It attempts to decompose the world in terms of interfaces that vary on a single type. To deal with the real problems you need multisorted algebras - families of interfaces that span multiple types. I find OOP philosophically unsound. It claims that everything is an object. Even if it is t…

The original article referred to "true OO" which actually does't start with classes, but rather objects. The OP is talking about using functions that are grouped together in objects, so it's a different model than standard OO or class-based OO

Re: Where FP meets OO

#30

In CLOS.

Why there are so many ignorant idiots in the world? According to Alan Kay, the essence of OO approach (or paradigm if you wish) is a synthesis of a few fundamental concepts (like a Lisp itself) where not a single one can be removed because harmony (or balance) would be destroyed, and an ugly, mediocre construction would emerge instead (Java). The concepts are: * First-class closures - isolated, share-nothing abstract…

> 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...

Post reply on HN