Slashdot Mirror


OCaml For the Masses

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.'"

10 of 338 comments (clear)

  1. haskell for the masses? sure, but only... by tulcod · · Score: 4, Insightful

    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.

    1. Re:haskell for the masses? sure, but only... by HiThere · · Score: 3, Insightful

      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.

      --

      I think we've pushed this "anyone can grow up to be president" thing too far.
  2. They're not equal though... by Anonymous Coward · · Score: 5, Insightful

    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.

    1. Re:They're not equal though... by Anonymous Coward · · Score: 3, Insightful

      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?

    2. Re:They're not equal though... by Waffle+Iron · · Score: 3, Insightful

      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.

    3. Re:They're not equal though... by Waffle+Iron · · Score: 3, Insightful

      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.

  3. Re:Needs platform adoption first. by Laz10 · · Score: 3, Interesting

    This is why I think Scala will succeed.

    Scala has all the advantages that the article mentions AND you can integrate and reuse your old Java or .NET code and libraries.

    It's there. The tooling doesn't suck half bad anymore. The world just needs to find out.

    I personally think that Scala will win over the 10% best Java programmers as soon as the tooling is comparable to Javas.
    And that might happen within the next 1-2 years.

  4. Re:Another functional programming fan by dkleinsc · · Score: 5, Interesting

    My favorite code to read is OOP stuff written by coders who understand and make use of functional programming concepts. They know how to write things that are stateless when that makes sense, and use state in an appropriate manner when that makes sense.

    And yes, by all means use it when appropriate. But don't think that Lisp is always the right language for scripting your text editor (dodges blow from Emacs partisan).

    --
    I am officially gone from /. Long live http://www.soylentnews.com/
  5. Re:Shorter code? by shmlco · · Score: 4, Insightful

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

    We didn't.

    --
    Any sect, cult, or religion will legislate its creed into law if it acquires the political power to do so.
  6. Re:Practicality drives use by mbone · · Score: 4, Insightful

    '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.