by vimes656 on 12/13/13, 11:17 AM with 139 comments
by barrkel on 12/13/13, 1:13 PM
The article is chasing down the wrong tree when he tries to build an Option type in C++, though. The normal OO way to handle the same class of functionality as ADT sum types is to use separate subclasses. What he's not acknowledging is that OO and functional+ADTs both only handle half the expression problem[1], in different ways. There's no absolute superiority for either model. It depends on the domain.
Less mutability is good almost everywhere though. The lack of persistent data types is a blight on almost all non-functional container libraries.
by choult on 12/13/13, 12:04 PM
At the end of the day, pick what language and coding paradigms best suit your problem domain and you as a coder. Pick right, and there's no mistake there.
by xcthulhu on 12/13/13, 2:14 PM
1. Dynamically Typed Languages (LISP, Erlang, Smalltalk, Python, Ruby, and Javascript) are all easier than Haskell, JAVA, C++ or any other typed language for working with ADTs. Whether the language is OO or not isn't really relevant. On the other hand, you loose type-safety/efficient representations. But life is filled with choices, different tools are good for different things at different times.
2. You can have closures in a class based language. Here's some rather exotic Python code that uses both for measuring the performance of iterators: https://github.com/wearpants/measure_it/blob/master/measure_...
Smalltalk and Scala also have closures. It's not an either/or for classes vs. closures in programming language land.
3. There's more to concurrency than shared memory, so immutability is again a weapon that is good for some battles. If you have an app which you've factored into workers, unless they are on the same machine they'll need to communicate. Having your data be serializable is more important than having things be immutable in this context. What a worker does with data while it is handling it can involve lots of mutation.
So everyone should take a big breath, and remember that there's no one way to think about software and there's no universal rules, other than probably P != NP and stuff like that.
by rowanseymour on 12/13/13, 12:13 PM
by arithma on 12/13/13, 12:37 PM
by rayiner on 12/13/13, 12:16 PM
by pbsd on 12/13/13, 1:36 PM
Does anybody understand what the author means by this? STL's algorithm library does not use class hierarchies for anything. And they often take functions (be they free functions, lambdas, or functors) as arguments.
by auggierose on 12/13/13, 12:05 PM
by draegtun on 12/13/13, 1:52 PM
PS. Just submitted to HN - https://news.ycombinator.com/item?id=6900426
by swah on 12/13/13, 1:27 PM
I suppose most folks here disagree?
by alkonaut on 12/13/13, 2:18 PM
The most important thing in my opinion is tools and platform support. Show me a fast, good looking IDE with good autocomplete/intellisense/integrated debugger and UI tools for ML. See?
Is there an abundance of libraries and api wrappers available (that doesn't require you to do straight C-interop)? See?
Also: the design of a language should be done with the tools in mind. While there is not much difference between norm(vec) and vec.norm() the latter is the form that supports autocomplete. So even for functional languages, being able to use member properties and member functions is an absolute reqirement to support the tooling that we expect.
You could say that F# dominates C#. It has almost the same tool and library support, while having the features you expect from an ML type language.
by al2o3cr on 12/13/13, 3:22 PM
The obvious conclusion is that any statement that contains the phrase "the obvious conclusion is" is 100% BS, including this one.
by toolslive on 12/13/13, 12:32 PM
There are other problems with Object-Orientation. For example, it tends to scatter allocation which has performance impact. ( see this nice presentation: http://harmful.cat-v.org/software/OO_programming/_pdf/Pitfal... )
If performance is not an issue, I'd guess the price you pay for OO is that you eschew parallelism and concurrency.
by mtdewcmu on 12/13/13, 8:52 PM