One great no-nonsense feature of OCaml is that you can just link programs directly to C code, include a tiny C wrapper, and call straight into C with virtually no overhead (literally no overhead for functions that don't need to allocate on the OCaml heap).
Nothing at all against OCaml, but it puzzles me where these HN micro-fads come from. There have inexplicably been a surge in OCaml posts on the front page over the past week.
Which is perfectly fine, except that I haven't gotten around yet to learning Rust (i.e. last month's fad). I'm still busy digging into Go (i.e. the fad from six months ago), having grown bored with Scala (i.e. ancient history, at least a year or two).
It is always exciting to see the fad spotlight shine on a mature language, since reaching production-ready status is usually the point at which languages stop being cool. However, the Haskell surge also rolls back around every few months, and they seem to think that OCaml isn't "pure" enough. So what to do?
Are these short-lived bubbles the result of coordinated HN ranking manipulation, or do brief convergences of interest just spontaneously bubble up by coincidence?
I've long thought OCaml was weirdly suppressed. It's a language that makes a lot of sense for a lot of problems; the only thing I can think is maybe people were put off by thinking strongly typed = java? It's particularly irritating that the Go folks never seemed to have looked at it, since their language could stand to learn a lot from OCaml.
Maybe the language is finally hitting critical mass? Maybe lots of people are hitting the same shaped problems at this stage in the evolution of our cloud platforms? Maybe it's just dumb luck?
For your specific things: Rust is probably not mature enough yet but worth keeping an eye on. Go makes me cry. Scala does a lot of the same things OCaml does as well or better, at least if you "stick to the good parts" (there's a ton of extraneous crap in Scala); if you're in an environment where the JVM is acceptable then TBH you won't gain ever so much from having both in your toolbox.
Haskell is the tough one. My take is that purity is a very heavy burden, and even the most advanced language in the world can only go so far to alleviating that. But the power it grants you can be huge - or can not. If you find purity worthwhile, go with Haskell. But if you just want the functional power boost and don't want to immediately expend most of it on carefully tracking your effects, OCaml is a perfectly good choice; at the least, it's an incremental improvement in the Haskelly direction, without having to wear the hair shirt right away. I'd say much the same for Scala.
My (somewhat rambling) 2cents, since I started working on improving this via OCaml Labs.
- Poor tooling: OCaml (and ML) is taught at a number of institutions so undergrads do have experience of it, yet few places seem to use it in production. The stories I heard of how they had to manage their systems would have put me off from ever wanting to learn it. OPAM, and the new tooling around it has changed all that.
- Fragmented community (outside academia): Of those who've used OCaml, there are those who love the language but they may end up feeling a bit isolated as they're unaware of others who can help/support them. They either soldier on alone or move on to something else. This shouldn't be surprising if you believe the 1/9/90 rule -- 1% make/do stuff, 9% use/participate and 90% just consume. I'm suggesting that the quiet 90% aren't really aware of each-other's existence and don't progress into the 9%. The work around refreshing ocaml.org, CUFP, more blogging etc is helping this.
- Missing 'killer app(s)': Using a language for it's own sake isn't very compelling. There need to be tools or products that people (devs) find impressive or cool that have been written using OCaml, where it was clearly the right tool for the job. This drives interest in the language with a purpose and encourages people to make/contribute things. I believe Mirage OS, Hack and recently Flow have helped this (as well as the effort of those projects to actively disseminate their work - see above comment).
With the above in mind, I had a couple of thoughts in the early days of OCaml Labs (I'm sure these weren't original).
Thought 1: Improve on all the above and existing users who've quietly appreciated the language will feel more confident in revealing themselves to support a growing ecosystem.
Thought 2: If thought 1 is true then some of those, who've come out to support the ecosystem can feel more confident in advocating for it and draw in new users. Combined with the above, this sets up a virtuous cycle.
As a result, I'd expect to see more stories on HN, Reddit, Twitter elsewhere that refer to OCaml, either as a language or because of tools built with it. In other words, this shouldn't be a fad but merely revealing another option to solve certain kinds of problems.
I would like to take this opportunity to thank you for the enormous effort that you and your colleagues have dedicated to improve the quality of the language ecosystem and to create an open and friendly community.
Your work is showing the results and its really inspiring.
Weirdly enough it used to have MLDonkey which has pretty much become irrelevant in the age of bittorrent, so I don't think "have a killer app" is that simple a factor (though possibly that wasn't really dev-oriented software).
You're right. What I meant was that someone looks at something and says "This is so cool/interesting/useful, I wonder how they made it?" For a language like OCaml, this means getting existing devs interested but the same approach works for less technically experienced people, who are keen to know how basic websites work (c.f plethora of how to code programmes).
Possibly. Also, not-so-good tooling, and the fact that said community isn't numerous. Not to mention a reputation as an academic language, the fact that it's old and the lack of marketing.
As someone who had a recent highly upvoted micro-fad submission (FreeBSD): I was not involved in coordinated HN ranking manipulation, but it was also not coincidence.
The recent $1m contribution to the FreeBSD foundation had me looking into FreeBSD again, when I found a nice presentation of Jordan Hubbard, which topped at #1. Probably my contribution lead somebody else to post a Ask HN about comparing FreeBSD to Linux.
I think this is how it often works - a popular submission raises interest, newly-interested people find more bits and submit them. At some point (as happened with Go), something gets so much momentum that it often tops Hackernews for a long period.
I don't think OCaml is a fad. It's a great language, probably my favorite, but it has so many problems that most people don't/can't/won't use it for any kind of real-world problems.
To list just the main problems:
- f*-up licence (open-source, but modifications can only be distributed as source-code patches)
- non-concurrent runtime (because the original developers don't care about it)
- ambiguous syntax which masks bugs
- inconsistent and incomplete standard library (there are replacements, but they too suck)
- shitty REPL (at least on Windows)
Well, that's about it. It's really fast, safe, expressive, as functional as it gets ([EDIT] also: compiled). Definitely one of the better-designed languages, and a great starting point for many other languages (F#, Swift, Rust).
Lately, there has been a lot interesting development that eased development in OCaml (basic overloading, this IDE), and more seems to be coming (concurrent GC/runtime).
- inconsistent & incomplete standard library: the library that comes with the compiler is basically the library of the compiler. Opam probably has everything you need.
- shitty REPL. use utop or use emacs. Anyway, I do think people on windows are better of using F#. But that's another discussion.
This is an nice example I put together about the ambiguous syntax:
if a > 0 then
print_endline "a > 0" ;
match a with
| 0 -> print_endline "impossible"
| 2 ->
match b with
| 0 -> print_endline "2, 0"
| _ -> print_endline "2, not 0"
| 3 -> print_endline "3, something"
| _ -> print_endline "something, something"
;
print_endline "done"
OPAM saves lives, that's true, but one still wishes there was a nice library of standard data structures; I use Batteries, which inherit the inconsistency of the standard library (for the sake of compatibility), the other real alternative is Core, which is undocumented.
I agree about the standard data structures, but there is no getting around the fact that it's not going to happen. You could have a look at Containers[1] if you want a break from Batteries.
I don't see it as a problem. This type of imbricated "match" is so common that you learn pretty fast to always use parenthesis. Also, it's often a good idea to try to match (a,b) instead.
In that particular example, the only misleading things are the indentation, and the lack of block delimiting for the inner match. The language grammar is accepted by the grammar compiler bundled with OCaml, which doesn't like ambiguous grammars.
Not to be that technically-anal guy, but the syntax of OCaml is not ambiguous from a CS point-of-view. However, it does have rules that can be counter-intuitive to humans.
> - f*-up licence (open-source, but modifications can only be distributed as source-code patches)
I didn't look at the license very closely, but there are a few forks of the language out there (check out github), which aren't distributed as patches.
IANAL but I think git makes it pretty clear what is the original software and what are the modifications which seems
to be exactly what QPL requires: "distribute your
modifications, in a form that is separate from the Software, such as patches."
Nope; you can download "master" (or branch) zip from GitHub, which contains the original with modifications, not separate. It's clearly against the licence.
I understood that at least a part of the larger programming community felt that the non-concurrent GC was limiting its future growth and shopped elsewhere for a production language.
> Nothing at all against OCaml, but it puzzles me where these HN micro-fads come from. There have inexplicably been a surge in OCaml posts on the front page over the past week.
Facebook just released a static type checker for javascript last week that happens to be written in OCaml. This release announcement was pretty well received here on HN[1]. After reading the commentary here and looking at Flow I've found myself reading more about OCaml. It wouldn't surprise me that others did the same and decided to share interesting articles they found.
I imagine the bubbles of popularity you mention are regularly kicked off by a similar event. When an article or piece of new software gets popular it follows that related material would also see a surge in activity.
Maybe there is a small 'positive feedback loop' effect.
I have some RSS feeds that I follow on topics that are interesting to me, which includes the ocaml.org RSS feed and the ocaml subreddit.
When I see something interesting that I think might be interesting to other HN readers I use the HN bookmarklet which either submits it (if it wasn't submitted yet), or upvotes it and takes me to the comments.
I don't know how many other people there are who follow those RSS feeds and post in a similar way, but it might explain the correlation between submissions and upvotes.
In fact one of my (non-OCaml related) RSS-based submissions triggered the ring vote detector although there was no ring voting from my side: https://news.ycombinator.com/item?id=8535171
Indeed I noticed more OCaml related topic on the HN frontpage in the past year or so, so that makes me think these kinds of topics and the associated discussions are welcome, or that at least there are a number of people interested in these topics.
Either the number of HN users interested in OCaml has grown lately, or they were always there and some of the recent popular OCaml topics on the frontpage has encouraged more people to post more OCaml related topics.
What "coincidence"? It's just because one person posts and article and 30,000 others see it, and some of them explore around (the linked website and related sites) and find other articles on the same topic to post.
And some fans of the topic also come back/first-time to HN attracted by the noise about the first post or some subsequent post, and they post too.
An interesting post on an infrequent topic gets people to Google around for this topic, and to find more postworthy stuff.
You won't get this effect with, say, a new PG essay, because everything loosely related to PG has already been posted to HN the minute it has been published. So their are no low hanging fruits coming in batch as soon as you shed light on the subject.
There have always been micro-fads on HN. Probably has to do with the karma system. Once something rises into the top 10, you know there's an interest. Give the audience what's hot.
This is basic human nature that we observe everywhere, everyday. News, movies, TV, books, start-ups, etc.
nope, there were microfads on Usenet, where there was no karma. it's just a matter of the medium supporting slow conversations extended across multiple threads. think of this as a single desultory conversation about ocaml; we just had one about bsd and we will have others.
I'd be curious to do a geographic analysis of IPs that upvote. Anyway to get this data? I'm pretty sure most OCaml upvotes are coming from financial firms in NYC.
I'm pretty sure they'd be drowned out by the number of US readers and the effects of timezones. The US comes online after Europe and if they don't upvote the same stories, they won't hang around.
The FCT-UNL was very strong in functional and logical programming back in the 90's, when the informatics degree started as an offspring from electronics.
We had Caml Light (OCaml predecessor) was used in quite a few classes, the other being SWI Prolog. Logical Programming was also part of electronic degree.
Since a few of the teachers are still at the university I would expect that they have eventually moved from Caml Light to OCaml, if they keep teaching the same classes.
I am from Aveiro, studied at the FCT-UNL back in the early 90's and nowadays live in Germany.
Actually the ML language I tend to use is F#, due to tooling and me spending most of my time on Windows.
Rust seems like a pretty consistent fad - it has come up in the last year pretty regularly, with the usual talking points (memory safety, systems languages, too immature for production, "when will 1.0 be released?"). Though I'm biased in that I actively seek out news on Rust.
Yes, there are always too many ideas to explore and too less time. However if you want to look into a static typed functional language I would go with Haskell as it tries harder to exploit a type system to do useful work (although there are even more sophisticated ways to do programming, i.e. by writing proofs (~= programs) in proof-systems, e.g. coq, Isabelle, etc.).
I was introduced to OCaml at my University, but switched later to Haskell and it seemed simpler too me. Furthermore Haskell's ecosystem seems to be more major (or maybe just more vocal?).
OCaml and its ecosystem are becoming so enticing day by day I feel like I am running out of excuses not to dive in NOW :-)
Obviously it's extremely powerful in many different domains. But one particular area I am interested in is mobile app development. Google search shows OCaml indeed has libs/tools for writing and compiling apps. I am curious about what's the current status and experience in using OCaml in Android/iOS development.
Jeffrey Scofield has a OCaml cross-compiler for iOS [1], and a number of of example apps are available, including ones using OpenGL ES.
The bridges connecting OCaml to iOS UI components are incomplete, so you might have to do a bit of work to support certain components, but the work would be reusable. Not difficult if you follow the example apps, but maybe tedious. I think the effort is worth it for what OCaml gives you.
I think one of the most realistic options would be to explore F# on Xamarin, if you are willing to pay the indie subscription fee (for Xamarin, that is).
F# is a superset of OCaml (well maybe not very strictly speaking but practically for all intents and purposes). Xamarin is gaining a lot of traction as a platform for writing native apps that deploy to Android and iOS.
Personally I have very good experiences with both the language and the platform, I would recommend you check it out.
That is not entirely true, there is some overlap but also enough distinct features on the language level to make a difference. For example object oriented features in OCaml are quite different, OCaml has a more powerful module system (functors), it has open polymorphic variants, extensible syntax. F# has also a number of features that Ocaml hasn't, but it is definitely not true that one is the superset of the other.
The runtime situation is arguably also a matter of preference, Ocaml compiles down to fairly efficient machine code and has a well tuned garbage collector, whereas F# at least initially had to rely on a garbage collector that was tuned for a different use case.
You give a very clear overview of the differences between the languages and I agree it is important to stress that there are significant differences between the two. The OP mentions mobile development though and if the goal is to ship apps targeting iOS and Android, it is not going to be practical to use OCaml- hence my suggestion.
For me F#'s syntax is so clean and pleasant to look at, I just love it. But having been in the JVM land for too long, at the beginning I like to get a bit more 'native' and learn OCaml. Hopefully acquired functional programming knowledge can be transferred to F#+Xamarin app development later.
I wish i could try this editor but had no luck compiling it. Some troubles with deps (lablgtk) and then infinite compile cycle issue i could not resolve. Would be nice to have deps included in install script or something.
Ubuntu 14.04. I used opam to install lablgtk ( before that installed gtk+2.0 ) also installed xml-light with opam and then got infinite loop when compiling. Ocaml 4+
Did you run this before building?: eval `opam config env`
I tried this Dockerfile and it succeeded, maybe compare your steps with the ones below.
If it still doesn't work try moving this discussion to stackoverflow or the OCaml mailing list and provide the output when the infinite loop happens.
FROM ubuntu:trusty
RUN apt-get -y update && apt-get -y install opam aspcud && opam init -y
RUN apt-get install -y m4 libexpat1-dev libgtk2.0-dev
RUN opam install -y ocamleditor
Sincerely this project should be moved to GitHub and a milestone for modernisation should be created (eg: port it to 4.02, add a plugin system to ease integration with code analysis and build tools, etc).
Currently the only active developer (according to logs) is the original creator of the project, while the project has potential to be maintained by the community.
Add to it a native graphics support for OS X, a decent documentation and suddenly you have a dream IDE.
https://github.com/libguestfs/libguestfs/tree/master/v2v
https://github.com/libguestfs/libguestfs/tree/master/builder
https://github.com/libguestfs/libguestfs/tree/master/customi...
https://github.com/libguestfs/libguestfs/tree/master/resize
https://github.com/libguestfs/libguestfs/tree/master/sparsif...
https://github.com/libguestfs/libguestfs/tree/master/sysprep
One great no-nonsense feature of OCaml is that you can just link programs directly to C code, include a tiny C wrapper, and call straight into C with virtually no overhead (literally no overhead for functions that don't need to allocate on the OCaml heap).