Live data from Hacker News

Why OCaml, Why Now?

spyder.wordpress.com

101–106 of 106 posts

Re: Why OCaml, Why Now?

#101
post #62

Earlier quoted context omitted.

I assure you that it's not a trick question, just a poorly worded one. Imagine that I'm making a page that converts meters to millimeters. The obvious part of the haskell code is convert :: Double -> Double convert = 1000 * The part which isn't obvious to me is how I get input from the user or display the result. I know how to do that in the IO monad through standard haskell, but I wouldn't know how to handle it in H…

I think fay uses its own FFI, but with haste you just use the normal FFI to call normal javascript functions the same way you would interface with C code from haskell. There's no need for special bindings or anything. You could certainly make a wrapper for jquery if you were crazy (and I'm sure someone has already done so), but this idea that you need some special DOM library to do things that javascript already does…

Thanks for the clarification. The key part that I was missing was the FFI. I'd encountered projects like this in the past with either no FFI or no documentation for the FFI and I couldn't figure out how to talk to the DOM. I'm more than happy to drop down to javascript for those parts, but I wasn't sure that I'd have the option.

Re: Why OCaml, Why Now?

#102
post #5

For me Scala has been the not-quite-as-good-as-haskell-but-more-industrially-acceptable language. I'd be very interested to see a more neutral comparison of functional languages for compile-to-JS, because if anything Haskell seems more popular for that - I hadn't heard anything about compiling OCaml to JS before this.

I've put a lot of work into a compile-to-JS evaluation for my day job. It's not suitable for public consumption, but of our top 5 choices: - both Kotlin and ClojureScript don't compile code written in their "native" language (java) to JavaScript, limiting the ability to leverage existing libraries. - ScalaJS is still experimental. - Haskell looked promising, I asked a haskell programmer to run that evaluation for me,…

Did you examine Ceylon? It seems to avoid the problem you describe with Kotlin and ClojureScript by explicitly abandoning the Java native library.

Re: Why OCaml, Why Now?

#103
post #102

Earlier quoted context omitted.

I've put a lot of work into a compile-to-JS evaluation for my day job. It's not suitable for public consumption, but of our top 5 choices: - both Kotlin and ClojureScript don't compile code written in their "native" language (java) to JavaScript, limiting the ability to leverage existing libraries. - ScalaJS is still experimental. - Haskell looked promising, I asked a haskell programmer to run that evaluation for me,…

Did you examine Ceylon? It seems to avoid the problem you describe with Kotlin and ClojureScript by explicitly abandoning the Java native library.

I haven't, no. We excluded the vast majority of AltJS languages as the size of community and availability of third-party libraries was a significant factor in the evaluation.

Re: Why OCaml, Why Now?

#104
post #97
post #38

Earlier quoted context omitted.

This won't be a problem for very long. See http://www.cl.cam.ac.uk/~sd601/multicore.md for the working design.

But "someday we'll only be a decade behind haskell" isn't much of a reason to choose ocaml over haskell.

I don't think multicore will be touted as a reason to choose OCaml over Haskell, but it will remove one of the reasons to avoid OCaml. Subtle but important difference :)

Re: Why OCaml, Why Now?

#105
post #97

Earlier quoted context omitted.

But "someday we'll only be a decade behind haskell" isn't much of a reason to choose ocaml over haskell.

I don't think multicore will be touted as a reason to choose OCaml over Haskell, but it will remove one of the reasons to avoid OCaml. Subtle but important difference :)

It won't though. Because it'll still be a decade behind haskell. People want more than just "ok, you can use multiple OS threads now". They want a concurrent IO manager, painless and seemless multiplexing of low cost green threads over OS threads, and high level concurrency and parallelism constructs. It is going to take a long time for ocaml to catch up to haskell in this department, and who knows what haskell is going to be offering by then.

Re: Why OCaml, Why Now?

#106

Earlier quoted context omitted.

> everything will parse fine. That's an exaggeration. There are circumstances in files where it's necessary. I didn't realize this, which hung me up for a long time.

Would you care to share an example? I've never encountered a justifiable need to write ;; outside the REPL. The only uses of ;; I've encountered "in the wild" were hardly reasonable: essentially top-level code that was not wrapped in a "let () = ..." statement.

I don't recall seeing that recommendation before this thread. That may just be my blindness in skimming things too quickly. In any case, I think it indicates a wart in the language when you have to wrap everything in otherwise useless let blocks just to get it to parse.
Post reply on HN