News for hackers. Stuff that matters.
Re:We need less powerful languages by colanderman on Sunday November 15, 2015 @06:11PM (#10571668)
You misunderstand (as most do): I never said function composition was a bad idea; I do it all the time.

My only claim is that you don't need a Turing-complete language to compose functions. As an thought-exercise, consider replacing all uses of first-class function compositions in any given OCaml program with top-level module compositions. You lose nothing: no-one (who designs maintainable software) uses the full expressive power of a Turing-complete language to manipulate first-class functions.

(Of course there are more user-friendly ways to implement second-class functions, which make using them less a burden, but no extant language has such a system.)

Re:We need less powerful languages by catnaroek on Sunday November 15, 2015 @07:24PM (#10571892)
When did I say “function composition”? What I said is “composing solutions to smaller, more tractable problems”. If you divide a problem `FooBarQux` into a sequence of subproblems, `Foo`, `Bar` and `Qux`, sure, these solutions must be combined using the function composition operator. But there are other ways to decompose problems. For instance, splitting a problem into a DAG of subproblems with overlapping dependencies gives rise to dynamic programming.

And, no, an ML-like module system wouldn't make up for the lack of first-class functions. Standard ML doesn't allow any module recursion whatsoever, and, while OCaml allows it, it's quite unwieldy to use in practice. It would be literally impossible to define a function like `fix`, which requires the ability to call its function argument (let's call it `f`), supplying an expression containing `fix` itself as argument.

Re:We need less powerful languages by colanderman on Monday November 16, 2015 @12:41PM (#10575781)
Since when do you need first-class functions for dynamic programming?

How often have you had to define `fix`? It's not even possible in certain strongly typed functional languages.

I stand by my assertion. First-class function manipulation is not a thing 99% of programs need to do.