I realize that Martin O. and others have discussed the integration of OOP and FP many times, but what I have yet to see is a clear explanation of what OOP adds that cannot be done as well with pure FP. Can anyone explain that or provide aa link to an explanation that is already out there? Thanks.
--Russ P.
--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Here is a scala example from the pamphlet. This is probably the most
non-idiomatic piece of scala code I have ever seen. I think this does
not even deserve discussion.
public boolean hasUpperCase(String word) {
if (null != word)
return any(charactersOf(word), new Predicate() {
public boolean apply(Character c) {
return isUpperCase(c);
}
})
else
return false;
}
On Tue, Dec 2, 2014 at 9:45 PM, Raoul Duke <rao...@gmail.com> wrote:
>>> I realize that Martin O. and others have discussed the integration of OOP
>>> and FP many times, but what I have yet to see is a clear explanation of
>>> what OOP adds that cannot be done as well with pure FP. Can anyone explain
>>> that or provide a link to an explanation that is already out there? Thanks.
>
> http://lambda-the-ultimate.org/node/2410
>
> --
> You received this message because you are subscribed to the Google Groups "scala-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to scala-user+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to a topic in the Google Groups "scala-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/scala-user/EJcyNz9s8I8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to scala-user+...@googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "scala-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/scala-user/EJcyNz9s8I8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to scala-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
In Scala, this is usually solved by combining the constraint with the data structure at construction, but this only works because typeclass instances are first class values. In e. g. Haskell this approach is kind of horrible, because typeclass instances can be incoherent, with no reasonable way for the developer to check for coherence (typeclass instances are second-class) and disallowing orphans is like burning down your neighborhood because of an overgrown garden.
This doesn't have much to do with OO though as you can have first class instances (basically records) and implicit parameters in functional languages as well (Agda has this for example).
It all comes down to the definition of OO and the key concepts there IMHO is the implicit this parameter and subtyping which leads to interesting combinations. Basically all other concepts available in common OO languages can be easily emulated in an FPL using records and functions/closures.
While everything can be emulated, I have yet to see a functional language where "emulating" dynamic dispatch crossed the line from "hey, have a look at this crazy hack" to "this is sufficiently clean implementation of the concept which I'd recommend using in real projects".
"OOP is an expensive disaster which must end"
On the "sub-module" level, I'd say that where OO really shines is dynamic dispatch (in fact, I'd say it's the only thing that really matters about OO below modules).
--
You received this message because you are subscribed to a topic in the Google Groups "scala-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/scala-user/EJcyNz9s8I8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to scala-user+...@googlegroups.com.
On 03/12/2014 17:22, Simon Ochsenreither wrote:
While everything can be emulated, I have yet to see a functional
language where "emulating" dynamic dispatch crossed the line from "hey,
have a look at this crazy hack" to "this is sufficiently clean
implementation of the concept which I'd recommend using in real projects".
Clojure's multi methods and Elixir's equivalent are more than adequate for real projects.
gvim