[Haskell-cafe] How to fulfill the "code-reuse" destiny of OOP?
bugfact at gmail.com
Wed Jan 13 04:51:37 EST 2010
On Sun, Nov 1, 2009 at 2:57 AM, Gregory Collins <greg at gregorycollins.net>wrote:
> Doing OO-style programming in Haskell is difficult and unnatural, it's
> true (although technically speaking it is possible). That said, nobody's
> yet to present a convincing argument to me why Java gets a free pass for
> lacking closures and typeclasses.
I might be wrong, but doesn't Java's concepts of inner classes and
interfaces together with adapter classes can be used to replace closures and
typeclasses in a way?
An inner class allows you to implicitly capture the parent object
("environment"), just like a closure does in a sense.
Interfaces group together methods, like type classes do.
Although I'm actually a C# fanboy for doing "industrial" programming, I
think the Java designers did an excellent job, finding a good balance in
language features, ease of use and readability, and although C# does offer
closures and many more FP constructs, I really miss the above Java
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe