Why OCaml, Why Now?
21–30 of 106 posts
Re: Why OCaml, Why Now?
#22There was a presentation at the FP eXchange in London last Friday about mirage and many a mind was blown!
Re: Why OCaml, Why Now?
#23I'm glad that the author is picking up a new functional programming language, but choosing OCaml over Haskell because of support for the Javascript implementations strikes me as choosing a BMW over a Mercedes[0] because of the number of cupholders it has. If you don't have a particular goal in mind (ie, "I work at Jane Street and need to be compatible with our existing code"), there are a number of other factors in t…
Re: Why OCaml, Why Now?
#24Earlier quoted context omitted.
;; is a special token used only in the REPL to force evaluation, it is not something you ever use in real code.
Well, that explains a lot! I'm embarrassed I never got past that.
http://ocaml.org/learn/tutorials/structure_of_ocaml_programs...
(someone really should go through these tutorials and fix the various misleading parts)
Basically, the rule is to use "let () = ..." for your main block / top-level code and don't use ";;" ever.
Re: Why OCaml, Why Now?
#25Re: Why OCaml, Why Now?
#26I'm glad that the author is picking up a new functional programming language, but choosing OCaml over Haskell because of support for the Javascript implementations strikes me as choosing a BMW over a Mercedes[0] because of the number of cupholders it has. If you don't have a particular goal in mind (ie, "I work at Jane Street and need to be compatible with our existing code"), there are a number of other factors in t…
It sounds like you have a very language-centric view of the world. In practice, deployment is everything. (Why do people write code in Objective C? Because iPhone.) Having a solid implementation for your target platform is very good reason to pick a language.
> Having a solid implementation for your target platform is very good reason to pick a language.
I'm not sure where you got that out of my comment; it was exactly the opposite.
My point was that neither OCaml nor Haskell have particularly strong implementations in this area (to my knowledge). Last time I checked, the ability to write Javascript using both languages was of experimental and/or novelty use only (hence the "cupholders").
And that still doesn't change the fact that a web app can be written in any language - the only part that needs to run in Javascript is the client-side. Depending on how you architect your app, this may not be much at all. (There are very few webapps that actually need much logic in Javascript - if you want to avoid JS[0] while writing complex webapps, it's actually very easy to do so in many cases.)
[0] or anything else that is translated into JS
Re: Why OCaml, Why Now?
#27Xavier Leroy (the creator of OCaml) and his team at INRIA didn't think this was a big deal because when they were writing this stuff, processors were single core and had been since the beginning. Sure there were multiprocessor machines (not the same as multicore as there are multiple die), but those were only meant for servers/workstations. OCaml seemed very promising around 2006, the peak and end of the single core era with the Intel Pentium 4. What made OCaml so impressive was not only was it this beautifully simple, high-level functional language, but that the native compiler produced very fast code that was comparable to C/C++ performance. However, as multicore processors were introduced (Intel Core, Core 2), not having this capability made writing new code in OCaml less appealing. There are solutions like MPI, but that's lame. The same excuses you hear in the Python world about having true multithreading you hear in the OCaml world. Microsoft was able to do it with F#, which is essentially a clone of Caml by targeting their .NET CLR. Haskell is able to do it with GHC.
I still think OCaml is a wonderful language -- not having true multithreading doesn't make it useless. However, to me it has become more like a statically-typed Python which I can use for scripting. Having to use hacks like MPI to do multicore processing is a huge turn off in a multicore world. This is again nothing against the language, but the standard implementation needs a concurrent garbage collector and kernel threads. Otherwise I think OCaml may be doomed to irrelevance in the long run, which would be truly sad.
Re: Why OCaml, Why Now?
#28Earlier quoted context omitted.
Well, that explains a lot! I'm embarrassed I never got past that.
Don't feel too bad about it. The official OCaml tutorial is also confused: http://ocaml.org/learn/tutorials/structure_of_ocaml_programs... (someone really should go through these tutorials and fix the various misleading parts) Basically, the rule is to use "let () = ..." for your main block / top-level code and don't use ";;" ever.
Re: Why OCaml, Why Now?
#29I've found it interesting that OCaml hasn't had more interest given the amount of recent momentum in Haskell. Haskell is an Ivory Tower. The features that generally draw one to the language also tend to be the things that eventually push one away. Haskell has grown a lot over the years however as the language evolves to allow general programming within a pure framework. OCaml on the other hand tends to make a comprom…
So for the very same reasons you give---Haskell has made fewer tradeoffs for "practical" programming---Haskell has become something valuable and interesting. On those tides the community has grown.
Re: Why OCaml, Why Now?
#30Earlier quoted context omitted.
As someone who would like to write his javascript in Haskell, how do you put text on the page without interfacing with the browser's DOM?
Is that a trick question? I don't know how or why you would try to do that.
$('#toggleLink').click(function() {
if ($('#toggleLink').html() == 'Show') {
showRollout();
$('#toggleLink').html('Hide');
} else {
hideRollout();
$('#toggleLink').html('Show');
]
});