Felix is to C++ what F# is to C# http://felix-lang.org/share/src/web/tut/tutorial.fdoc (I am not the author, just excited about this language) OCaML programmers will feel immediately at home. It is a mature yet actively developed whole program optimized, strongly typed, polymorphic, ML like language that can interact effortlessly with C and C++ and has coroutines and threads baked in, although use of threads is somew…
AFAICT you mention Felix whenever OCaml comes up, generally saying more or less the exact same thing each time.
Why OCaml, Why Now?
71–80 of 106 posts
Re: Why OCaml, Why Now?
#72I'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…
Re: Why OCaml, Why Now?
#73Look, I love OCaml and it's my favorite language syntax-wise, but the real big elephant in the room is not its JS-backend maturity. Rather it doesn't have kernel thread support...all threads are user-level just like Python due to a global lock for garbage collection. This means threads do not run concurrently across multiple cores. This is UNACCEPTABLE in 2014 - roughly 8 years since processors went multi-core. Intel…
Re: Why OCaml, Why Now?
#74Earlier quoted context omitted.
Not the original commenter but for me the big ones are purity and cheap direct access to C code.
You can program in pure mode in scala too(and scalaz framework helps in it). FFI is great but i don't miss it. For better performance there is the java collections and libraries.
The java collections & libraries don't help me when I need to manage my own memory. I've spent entirely too much time in the unsafe package because the JVM doesn't allow me to do cheap ffi unlike Haskell or even Microsoft's CLI.
Re: Why OCaml, Why Now?
#75I'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…
Re: Why OCaml, Why Now?
#76Earlier quoted context omitted.
For reference, here is the tutorial's example reformatted in a more reasonable way: open Random open Graphics let rec iterate r x_init i = if i = 1 then x_init else let x = iterate r x_init (i - 1) in r *. x *. (1.0 -. x) let main () = self_init (); open_graph " 640x480"; for x = 0 to 639 do let r = 4.0 *. (float_of_int x) /. 640.0 in for i = 0 to 39 do let x_init = Random.float 1.0 in let x_final = iterate r x_init…
The trouble with Ocaml is that you will probably get something like: $ ocaml o.ml File "o.ml", line 2, characters 0-13: Error: Unbound module Graphics And after you've googled for a while and had done: sudo apt-get install liblablgl-ocaml-dev The thing would install 23(!) packages. And after that you will get: $ ocaml o.ml Exception: Graphics.Graphic_failure "fatal I/O error". After which, if you've been in the indus…
Re: Why OCaml, Why Now?
#77Earlier quoted context omitted.
> It sounds like you have a very language-centric view of the world. > 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 usin…
Haste is a strong, useful, and impressively complete Haskell to JS compiler. Fay is used in production apps as well. PureScript is less mature still but pretty nice.
This is what I meant when I said "by virtue of support for existing libraries". js_of_ocaml translates compiled bytecode and can therefore make any pure OCaml library work in JavaScript without recompilation.
Re: Why OCaml, Why Now?
#78Earlier quoted context omitted.
http://elm-lang.org/ for example. To display text in the browser you would use - main = plainText "Hello, World!" From the page: "Elm is a functional language that compiles to HTML, CSS, and JavaScript". So yes, technically this is working with the DOM. But you are not writing code that interacts with a "DOM binding" directly per se.
I'm excited for PureScript for the property that it compiles to sane javascript. http://purescript.readthedocs.org/en/latest/intro.html#hello...
Re: Why OCaml, Why Now?
#79For 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.
- 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, but fay/haste aren't complete enough for serious (non-ui) JavaScript work and GHCJS generates 5mb JS files. - OCaml had a viable project in about half the time I estimated it would take.
And on a personal note, Scala seemed great at first but after SML/OCaml I find the number of times that I have to tell the type checker what I'm doing immensely frustrating :)
Re: Why OCaml, Why Now?
#80Earlier quoted context omitted.
The trouble with Ocaml is that you will probably get something like: $ ocaml o.ml File "o.ml", line 2, characters 0-13: Error: Unbound module Graphics And after you've googled for a while and had done: sudo apt-get install liblablgl-ocaml-dev The thing would install 23(!) packages. And after that you will get: $ ocaml o.ml Exception: Graphics.Graphic_failure "fatal I/O error". After which, if you've been in the indus…
The Graphics module is a core Ocaml library that is always available. In order to use it, it must be linked on the command line, similar to many other languages. Installing an unrelated OpenGL binding didn't magically make "ocaml o.ml" work. Based on this and the obvious trolling of your final paragraph, I'm hesitant to believe anything you said is true.
#load "graphics.cma";;
into the file first. And forgot about it, when writing the post. So no magic here. "Beautiful" syntax by the way.And no, I wasn't trolling. I just wanted to see what that recursion would do. The code is not exactly crystal clear there, with names like start_x and such. But it really did not work. And the syntax is really ugly. And you can believe what you like.