29 ms·
I've been using OCaml for a couple of side projects, and I have been absolutely blown away by the amount of power this language provides. It strikes a nice bala
by yen223 9y ago
I've been using OCaml for a couple of side projects, and I have been absolutely blown away by the amount of power this language provides. It strikes a nice balance between high-level expressiveness, while not sacrificing on performance.
I feel like OCaml is one of the programming world's best kept secret - if it had better tooling and better marketing, it could have taken over the world. I'm cautiously optimistic about ReasonML for this reason.
- noir_lord 9y agoHave you seen https://github.com/BuckleScript/bucklescript https://github.com/BuckleScript/bucklescript ? It's outputted js is fantastic.
- josteink 9y ago> if it had better tooling and better marketing It would known as F# :)
- thesmallestcat 9y agoVersion incompatibility is a big problem for OCaml. Every time I try to use it seriously, the recommended tools never seem to work together on anything but the latest version. It's like Rust, but without the "young language" excuse. My impression is that INRIA is too eager to add features and tweak the language. Next, everything builds so slowly, and just trying to set up Core, utop, and ocp_indent is a trial in patience, watching the same dep build again and again, confusion about OPAM switches.... nope nope. OCaml/OPAMs's got a distribution problem. They've pushed the complexity off to the end user and the experience is terrible. Jane Street planting their flag on the language and encouraging massive dependencies like Core, or shit like "corebuild" is even worse. I would never depend on anything OCaml-based on it unless it could be installed by my OS' package manager (Arch/AUR doesn't count, because it builds). That rules out most popular OCaml tooling, and ruins the development experience. I'd prefer OCaml to Haskell, I find it more practical, but I feel much better depending on Haskell-based software, which generally "just works." As much as they're a wart, Haskell syntax extensions are a real benefit. You can build new fancy Haskell software with older GHC versions.
- marmaduke 9y agoThe opam is pretty new. When I looked at OCaml a few years back my phd work, it didn't exist, so there's some churn in the tool chain I think your overstating the pain though. Even in other languages, best practice demands you pin a library version so you wouldn't have some of those issues.
- thesmallestcat 9y agoOPAM was released in 2013 and I recall it being mainstream by 2014. Maybe I am overstating the pain, but I've jumped through hoops for plenty of languages, and OCaml stands alone here. As somebody who's pretty good on the command line and at solving installation issues, the thought of a junior developer trying to get started with OCaml gives me shivers (probably another impetus for Facebook's Bucklescript).
- cies 9y ago> Facebook's Bucklescript I think you mean FB's ReasonML. Buckle is Bloomberg's OCaml-to-JS compiler.
- vvanders 9y ago> It's like Rust, but without the "young language" excuse. Howso? Stable Rust has been nothing but 100% solid for the past 1+ year I've worked with it.
- thesmallestcat 9y agoTools depend on Rust nightly. My points are more about the respective ecosystems than the core languages. For instance, getting up and running with RLS is a real hassle (in my experience, but I'm sure it's improving).
- vvanders 9y agoRLS is a pretty new thing and is very much a nice to have but not in any way required. I haven't used it until about a month ago. Racer worked just fine on Stable. I dunno, maybe you had a bad experience but considering how well Cargo and the stable compiler work I don't thing it's fair to categorize Rust as never working correctly.
- marmaduke 9y agoAgreed. I'm always looking for excuses to use it or F# at work but rarely come up.
- microcolonel 9y agoThreading is the one thing that's missing for me, in OCaml; they may have added it, but it wasn't there last I checked.
- yodsanklai 9y agoYou have light threads (Lwt or Async) that are sufficient for most purpose.
- hajile 9y agoSML/CML might interest you. http://cml.cs.uchicago.edu/ http://cml.cs.uchicago.edu/ -- the CML idea Three SML implementations with CML support http://www.polyml.org/ http://www.polyml.org/ http://www.mlton.org/ http://www.mlton.org/ http://www.smlnj.org/ http://www.smlnj.org/
- eatonphil 9y agoPoly/ML is the only "mainstream" implementation (and the only one on your list) with OS thread support. The rest are green threads. Various research offshoots from MLton have existed with full support for OS thread but none are still around and they haven't made it upstream. For the most part, the Standard ML native thread situation is not much better than OCaml's.
- throwawaysml 9y agoYou're forgetting SML# which uses MassiveThreads library and despite the name isn't for .Net. http://www.pllab.riec.tohoku.ac.jp/smlsharp/ http://www.pllab.riec.tohoku.ac.jp/smlsharp/ https://github.com/smlsharp/smlsharp https://github.com/smlsharp/smlsharp https://github.com/massivethreads/massivethreads https://github.com/massivethreads/massivethreads It was conceived at Tohoku University for use in Japan's high performance computing projects. SML# uses LLVM as a backend, has a nice FFI and EDSLs for SQL and JSON and a non-moving GC. All stemming from the use case it's designed for.
- weberc2 9y agoProject tooling and standard library are the two things keeping me from using it. If they built Cargo for OCaml and improved the standard library, I think people would flock to it. Although I never seem to quite get used to the syntax...
- yawaramin 9y agoMaybe you'll have better luck with ReasonML syntax?
- fasquoika 9y agoNot the parent, but ReasonML's syntax is actually not great. They fixed a bunch of pain points with OCaml but then added their own idiosyncrasies to make it look more like JS
- yawaramin 9y agoThey actually thought the JavaScript-like syntax through very carefully, trying to balance several factors (like JS appeal, future-proofing, simplifying, etc.). See https://www.reddit.com/r/reasonml/comments/6v2olv/new_syntax_after_pr_1299/dly4aa7/?st=j6uwyua3&sh=d68e1ffd https://www.reddit.com/r/reasonml/comments/6v2olv/new_syntax... for a quite informative summary of the changes.
- weberc2 9y agoYeah, I came to OCaml by way of reason, and I preferred reason's syntax, but the tooling and documentation were still very unpolished. The syntax niceness didn't do enough to justify sticking with it. I really like Rust's syntax and tooling (best of any functional/ML IMHO), I just don't want to spend all my time thinking through moves and borrows and lifetimes.
- yawaramin 9y agoTooling is getting better! Reason/BuckleScript recently shipped Elm/Rust-like errors: https://reasonml.github.io/community/blog/#way-way-waaaay-nicer-error-messages https://reasonml.github.io/community/blog/#way-way-waaaay-ni... Docs are more of a WIP right now, but I'm confident they'll get a handle on them: https://reasonml.github.io/api/index.html https://reasonml.github.io/api/index.html
- wenc 9y agoOCaml is great in itself, but in practical terms, it is only great for limited dependency projects (this however doesn't mean limited complexity--a Perl 6 implementation called Pugs was once written in OCaml. FFTW's code generator is also written in OCaml). In many projects where one has to "stand on the shoulders of giants", OCaml has a limited ecosystem to draw from. A practical compromise is F#, which is an ML language for the .NET platform. And even with Microsoft's heft behind it and a rich .NET ecosystem, F# is still a niche language used in finance and a few other specific domains. A functional language "taking over the world" is a tough proposition. That usually requires a strong use-case (like scientific computing--and now data science--for Python) and fungibility of expertise, which in turn calls for a language with a very low barrier to entry.
- profquail 9y agoMinor correction: `pugs` was written in Haskell, not OCaml. https://hackage.haskell.org/package/Pugs https://hackage.haskell.org/package/Pugs
- wenc 9y agoYou are right. Thanks for the correction.
- eru 9y agoYou are right about the difficulty of a functional _language_ taking over the world anytime soon. But as a consolation prize we are seeing functional features making it into more and more mainstream languages. Even people using eg C++ no longer look at you too funny if you explain that you prefer all your variables to be 'const'.
- gbersac 9y agoF# is even less used than OCaml and Microsoft lost interest in it. If you are into functional programming, you should rather choose Scala. Huge ecosystem, largely used in production. Compatibility with java mean you can have all the library you want. A lot of people love to trash sbt it's build system, but for me it always work as expected. And other tooling are just awesome (you even have IDE).
- eru 9y agoOCaml even does relatively well compared to Haskell: OCaml is a much simpler language with more predictable resource usage (space and time), but still gives a sizable fraction of Haskell's power. If you like Reason, you might also be interested in BuckleScript.
- lomnakkus 9y agoThis is exactly my experience. In fact, I moved from O'Caml to Haskell, but I still miss some things from O'Caml. (The most important of which is a good module language... but I think the Haskell world is getting that, eventually, via Backpack.)
- eru 9y agoOn a micro-level, or-Patterns are also pretty nifty. There's nothing technically keeping Haskell from getting them, it's just a problem of how to fit them into Haskell's already crowded syntax.
- ttoinou 9y agoI feel like OCaml is one of the programming world's best kept secret A little bit exagerated... In France we learn this language in a lot of post secondary universities / engineering schools