Live data from Hacker News

Why OCaml, Why Now?

spyder.wordpress.com

91–100 of 106 posts

Re: Why OCaml, Why Now?

#91
post #76

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,…

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 !

Re: Why OCaml, Why Now?

#92

I'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 does seem a little spurious at first, but part of the argument is that as js apps get larger, a static, functional language can be argued for to avoid problems with larger js codebases.

Re: Why OCaml, Why Now?

#93
post #25

"...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.

Agree, same true for JS - so many people trying to fix the mess...

Re: Why OCaml, Why Now?

#94
post #33

Earlier 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…

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 message.

Re: Why OCaml, Why Now?

#95
post #91

Earlier 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 !

Does that mean that K syntax could grow on me? http://en.wikipedia.org/wiki/K_(programming_language)

For this old C programmer, Python proved to have the most friendly syntax.

Re: Why OCaml, Why Now?

#96

Earlier 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…

>My point was that neither OCaml nor Haskell have particularly strong implementations in this area (to my knowledge)

They both do.

Re: Why OCaml, Why Now?

#97
post #38
post #27

Look, 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.

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

Re: Why OCaml, Why Now?

#98
post #20

I'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…

You are acknowledging that you are wrong without even noticing. No, haskell is not an "ivory tower". It is a very practical, useful language. That is precisely the reason it has gained so much momentum and usage. Ocaml had more users than haskell back in the mid 00s. Now haskell absolutely dwarfs ocaml. The reason ocaml doesn't get more interest pigging backing off of haskell is that there is no reason to use ocaml over haskell.

Re: Why OCaml, Why Now?

#99

Considering 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…

>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

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?

#100
post #94

Earlier 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…

Ocaml 3.12.1; Ubuntu 13.10. X server is available, Desktop is MATE 1.6.0, OpenGL also seems to work (glxgears works).
Post reply on HN