Earlier quoted context omitted.
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.
Seriously. You are so biased that it is easier for you to believe that other people are downright lying than to accept inconvenient truth. I was running it in the interpreted mode. Isn't that how one is supposed to run tutorials code? And obviously I've added the following: #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,…
Why OCaml, Why Now?
91–100 of 106 posts
Re: Why OCaml, Why Now?
#92I'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?
#93"...Facebook created ... a statically typed PHP variant..." - so happy to see another major tech company understand the merits of static typing.
that's because PHP is such a horrible language you need static typing to make sense of the crap.
Re: Why OCaml, Why Now?
#94Earlier 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…
$ ocaml graphics.cma test.ml
Debian splits OCaml into two packages: ocaml-nox (no X) and ocaml (everything). Make sure you're not using the nox version, and make sure you have an X server available (i.e. you're not running it on a headless server or something).
Still, "fatal I/O error" is a terrible error message.
Re: Why OCaml, Why Now?
#95Earlier quoted context omitted.
Seriously. You are so biased that it is easier for you to believe that other people are downright lying than to accept inconvenient truth. I was running it in the interpreted mode. Isn't that how one is supposed to run tutorials code? And obviously I've added the following: #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,…
Dont judge syntax when you are new to a language. Few syntaxes have the tendency to never grow on you, but it is surprising how most do, even when your first impressions were pretty bad. Remarkable abilities of the human brain !
For this old C programmer, Python proved to have the most friendly syntax.
Re: Why OCaml, Why Now?
#96Earlier quoted context omitted.
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.
> 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…
They both do.
Re: Why OCaml, Why Now?
#97Look, 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…
This won't be a problem for very long. See http://www.cl.cam.ac.uk/~sd601/multicore.md for the working design.
Re: Why OCaml, Why Now?
#98I'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?
#99Considering how strongly opposed the author is to dynamic typing, I'm actually kind of surprised they'd consider OCaml's type system to be acceptable. Technically, yes, it's a statically typed system. But its use of structural typing instead of nominative typing effectively means it takes half the compiler assistance you can get out of static type checking and chucks it out the window. Using structural typing means t…
It is quite rare for people to use objects in ocaml anyways, so it doesn't matter much.
>A language that doesn't do this is a language that can't be taught to understand the difference between 12 meters and 12 Newtons.
Sure it can. Make a type for meters and a type for newtons. Haskell won't think there is a difference between those if you make them both an int either.
Re: Why OCaml, Why Now?
#100Earlier 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…
Tried it here and it worked, both on Arch Linux with OCaml 4.01.0 and a clean Ubuntu/12.04 with OCaml 3.12.1: $ ocaml graphics.cma test.ml Debian splits OCaml into two packages: ocaml-nox (no X) and ocaml (everything). Make sure you're not using the nox version, and make sure you have an X server available (i.e. you're not running it on a headless server or something). Still, "fatal I/O error" is a terrible error mes…