3 ms·
If I was going to delve into another language why would it be OCaml over Haskell or Scheme?
by sigzero 16y ago
If I was going to delve into another language why would it be OCaml over Haskell or Scheme?
- chc 16y agoScheme has a Lispy syntax (good or bad depending on where you're standing, but probably not neutral) and doesn't have static type inference, which is the whole point of the article. Haskell is just enormously complex for anyone who doesn't have a very strong background in maths and category theory. Seriously, it's an amazingly cool language, but unless you can look at ST and not feel a little confused at first, you won't be able to shake the feeling that Haskell is smarter than you are. OCaml is a reasonable middle path. It has a lot in common with Haskell (H-M typing, ML syntax, pattern matching) and is largely pure, but doesn't absolutely force purity on a language level the same way Haskell does. Strictness is the default, with laziness as an option, so there are no surprising space leaks. IO is performed with IO functions, not with some bizarre monad that is the description of an action that would be performed.
- stonemetal 16y agoPersonally I like Haskell. As for reasons to choose it over Haskell, I find it to be a bit simpler and easier to get things done. Mutable state takes less work. For places where you might drop down to C for bit twiddly speed it is easier to replace C with OCaml than Haskell. You can still do lazy in OCaml though you have to choose it. It is a part of the standard library. Being an eager language it's evaluation model is easier to understand. OCaml vs Scheme is harder for me to answer I haven't used Scheme that much. Static typing if you like that sort of thing.
- mhd 16y agoThere are some practical reasons, but if you haven't learned any of them, it's hard to recommend Caml. Both Haskell and Scheme (and I'd add Prolog) offer some interesting ways of reasoning about programs, even if you don't end up working with them in the end. As for usage scenarios: Compared to Scheme, you might like the syntax more, it's statically typed and has a very fast compiler that doesn't even need to use C as an intermediate language. Haskell is much more pure regarding its functional nature and thus its way of interacting with a state-ful world can seem a bit intimidating. If you don't have a lot of math under your belt, Caml's way of interpreting code is a bit easier to mentally model. I've always thought of ML as the C to Haskell/Miranda's Pascal, for better or worse… Library-wise, Caml has a very good foundation for writing Unix software. Haskell has made major steps in catching up, Scheme is still a bit balkanized (going from your teaching language to the Chicken/Gambit/PLT infrastructure is not much easier thank taking up Common Lisp). I'm still surprised at how far Haskell has come in recent years in getting more libraries. It used to be slightly below Common Lisp in that regard, if my memory serves me. Now Hackage is huge. GHC always was a pretty good compiler, so nothing major about the language or its implementation changed. I also know of no big poster boy use cases, compared to e.g. Erlang. Linux hackers impressed by xmonad?
- flogic 16y agoI'll pick on Haskell since that's the one I've used and like. Sometimes you get the feeling that people go overboard with the type system, I've passed over potentially better libraries for ones that are a bit more redneck friendly. The next annoyance is operator explosion. Ran into one that was a constructor in Happs. Hoogle and Google were useless. Eventually grep won the day. The final issue I have is that sometimes the type in the standard libraries aren't quite what you want. Fortunately they seem to be fixing this.