Forgot your password?
typodupeerror
Programming

OCaml For the Masses 338

Posted by timothy
from the cue-up-the-language-bigots dept.
CowboyRobot writes "Yaron Minsky of Jane Street argues that the time has come for statically-typed functional languages like OCaml and Haskell. He cites many reasons and illustrates what he says is the most important, concision: 'The importance of concision is clear: other things being equal, shorter code is easier to read, easier to write, and easier to maintain.'"
This discussion has been archived. No new comments can be posted.

OCaml For the Masses

Comments Filter:
  • by tulcod (1056476) on Tuesday October 04, 2011 @02:01PM (#37601688)
    haskell for "the masses" is possible as soon as "the masses" has a degree in mathematics. java and php are copy-and-paste languages, functional languages simply take more thinking to compile at all, and i think many programmers are not prepared to do that to the required degree, although i'd love to be proved wrong.
  • by Anonymous Coward on Tuesday October 04, 2011 @02:05PM (#37601744)

    The importance of concision is clear: other things being equal, shorter code is easier to read, easier to write, and easier to maintain.

    All other things are not equal though, are they? Procedural programming is easier for humans to understand: most of us do no not think in a way that maps easily to functional programming.

  • by Anonymous Coward on Tuesday October 04, 2011 @02:17PM (#37601904)

    Or most of us didn't learn to program in a functional language, so our brains are used to thinking imperatively. Or were you born understanding code?

  • Re:Shorter code? (Score:5, Insightful)

    by shmlco (594907) on Tuesday October 04, 2011 @02:36PM (#37602138) Homepage

    If shorter, more concise code was always better, we'd have switched to APL years ago.

    We didn't.

  • by mbone (558574) on Tuesday October 04, 2011 @02:44PM (#37602252)

    'The importance of concision is clear: other things being equal, shorter code is easier to read, easier to write, and easier to maintain.'

    That was the idea behind APL. You could do amazing things in one line of code. I never, however, knew anyone who used it who thought it was easier to read, easier to write or easier to maintain.

  • Re:Shorter code? (Score:2, Insightful)

    by Anonymous Coward on Tuesday October 04, 2011 @02:47PM (#37602296)

    True, so on one end you have bloated, verbose languages like Java and Cobol and on the other end you have terse, unreadable languages like Perl and APL. So the key is finding the right balance. Ideally you want a language which is both readable and expressible. One that encourages reduction of repetitious code. One that allows you to build the abstractions to best express your intent as a programmer in a maintainable way.

    I'm of the opinion that C syntax is not best suited for this. Lisp is better, but everyone screams about the parens despite the fact that you have curly braces, parens, square braces and semicolons all over the place in the C languages.

  • by Waffle Iron (339739) on Tuesday October 04, 2011 @03:17PM (#37602820)

    Or most of us didn't learn to program in a functional language, so our brains are used to thinking imperatively. Or were you born understanding code?

    Our brains think imperatively because life is imperative.

    Imperative languages dominate computing because the real world is imperative.

  • by gilleain (1310105) on Tuesday October 04, 2011 @03:31PM (#37603020)

    I've been programming Prolog quite a lot (a bit CLP too), but still don't get monads, so I just shrug off your snobbish nonsense.

    Me either; I don't even think that the higher order concept like monads or arrows are even relevant to most programming. Also, I find actual maths easier to read than Haskell or lisp - it's not just a question of not 'getting' the language; it's not very gettable.

    (I hope no-one from lambda-the-ultimate comes across this comment thread or they'll be irritated.)

  • by HiThere (15173) <charleshixsn&earthlink,net> on Tuesday October 04, 2011 @04:20PM (#37603668)

    You misunderstand thing. General purpose languages, such as the C or Algol family (which includes, among others Java, Python, and Ruby) do, indeed, include concepts from functional languages. But they don't RESTRICT you to those concepts. It's the insistence that everything be unchanging that is the weakness in the purely functional languages. The Scheme family is the only group of that to have any measurable use. (Note that Lisp is NOT a functional language, even though the concept originated via a subset of Lisp.)

    There's much to be said for having the ability to have invariant elements in functions. There's very little in having the requirement that everything be that way. Note that many existing languages that have invariant strings ALSO have mutable strings. Java to name just the most popular example. So by all means allow functions to declare their values invariant. This allows lots of different kinds of optimization. But don't insist that all functions do so. And definitely don't insist that everything be invariant.

  • by Waffle Iron (339739) on Tuesday October 04, 2011 @05:21PM (#37604528)

    god no, why do you asset that life is imperative?

    Because each of us exists as one location in 4-dimensional spacetime. Our existence is a single thread moving uniformly forward through time, attending to one task at a time. Almost nothing in the real wold is stateless or immutable. Our brains evolved to deal with this reality.

    but apart, remember programming isn't something natural of the human, is learned.

    When I looked at the first BASIC program listing I encountered almost 40 years ago, I immediately understood what it meant. I didn't have to learn anything to relate to it. It's a list of steps to take, just like we do every day in the physical world.

    Most CS students struggle for a long time just to get a grasp on recursion, much less the various high-powered concepts from functional languages.

"Whoever undertakes to set himself up as a judge of Truth and Knowledge is shipwrecked by the laughter of the gods." -- Albert Einstein

Working...