11 ms·
Plans for OCaml 4.08
- WallWextra 8y agoThis is a nice counterexample to the wisdom that production compilers all use hand-written parsers. Of course, the current parser does suck, but...
- swah 8y agoIIRC OCaml compilation was super fast and the errors were useful and pointed to the correct line. What is/was the problem with the current parser?
- seanmcdirmid 8y agoGenerally auto generated parsers have huge problems with error recovery (bailing out quickly) and reporting. They usually exceed in performance however. I’m not sure where OCaml stands.
- WallWextra 8y agoAs the blog post says: "Error: Syntax Error". Helpful error messages have not been my experience.
- a0 8y agoSyntax errors are suboptimal. They are usually reported at correct location and it's relatively easy to spot them. On the other hand type error messages are simply awesome.
- chubot 8y agoOne issue is mentioned in the blog post: The days of Error: Syntax error. may be numbered
- prosses 8y agoThey do not want to change the parser but the parser generator.
- coldtea 8y agoHow is this a counter-example? They move from a auto-generated compiler that sucks to another one (whose quality is yet to be seen). Even if it proves to be great, it would still be an outlier.
- ericb 8y agoIt will be interesting to see how the $200 million+ Tezos warchest affects the popularity and development of OCaml. That seems to be a fairly large amount in relation to the size of the current OCaml ecosystem, and the whole purpose of the fund is to grow the ecosystem of Tezos which by necessity includes the OCaml ecosystem.
- cannam 8y agoI hadn't heard of Tezos. Following that up I find https://tezos.com/ https://tezos.com/, "a new platform for smart contracts and decentralized applications", leading to http://doc.tzalpha.net/index.html http://doc.tzalpha.net/index.html which is indeed full of Ocaml stuff. Where does $200 million+ come into it? What is the history there?
- the_duke 8y agoFB s interest in the ecosystem with Reason might also give a nice boost in development resources for libraries and the compiler.
- coldtea 8y agoI had a look at Tezos -- which I've never seen mentioned before. If you mean this "Tezos: the self-amending cryptographic ledger" ( https://tezos.com/ https://tezos.com/ ), this look like something done from 4 amateurs in their spare time. I don't know if it has "$200 million+" warchest, but if it does I pity the fools that gave it that.
- weavie 8y agoWhen did Jane Street take over development of OCaml? I knew they were heavy users, but I thought it was INRIA that were the main developers. This post implies that JS are running the show now...
- tormeh 8y ago>we in Jane Street’s Tools & Compilers group have been planning what we want to work on for inclusion in OCaml 4.08 You'll find similar phrasing among major contributors to Postgres.
- pyrale 8y agoThis looks like it works like Haskell: the original group still has control, but a group of consultancies has demonstrated the ability to reliably develop and get support for their extension proposals. JS is probably confident in their ability to get their developments merged.
- tomp 8y agoThe language was going nowhere under INRIA for ~10 years, we should be thankful for the uptick in commercial interest (Jane Street, Facebook, ...) and their contributions to the language ecosystem.
- weavie 8y agoI wasn't complaining, just curious. Jane Street have done a lot for OCaml and deserve to be a big say in its future.
- toolslive 8y ago"take over" is a big statement, but you could see signs of major influence as early as 2012-2013. It was already apparent at ICFP 2012.
- yminsky 8y agoThat's not the intended implication, and Jane Street has in no way taken over the show. Our PRs are discussed vigorously, just like everyone else's, and they're definitely not always accepted! Indeed, one of the great things about the OCaml compiler development process is that the core team is highly skeptical, and does a good job of rejecting marginal changes.
- leshow 8y agoCould someone write the equivalent of this in Haskell (assuming the GADTs ext). type 'a ty = Int : int ty | Bool : bool ty | String : string ty;;
- deleted 8y ago[deleted]
- def-lkb 8y agodata Ty a where Int :: Ty Int Bool :: Ty Bool ...
- deleted 8y ago[deleted]
- jonloldrup 8y agoI'm wondering whether Ceylon could be considered a modern day Ocaml substitute? It has a very strong type system, focus on immutability, a strong module system and Object Oriented capability. What's missing?
- sgt 8y agoI don't think Jane Street would be using OCaml to this extent if it needed a "modern day substitute". And the language is evolving, which is always a healthy sign.
- jonloldrup 8y agoOkay, wrong wording. However, Ocaml has several 'warts'. https://news.ycombinator.com/item?id=9583659 https://news.ycombinator.com/item?id=9583659 I suggested Ceylon as the 'modern day substitute' in the sense that it has had the opportunity to learn from mistakes made by the older FP languages. Ceylon has a very consistent type system and is therefore able to deliver more clear error messages.
- chillee 8y agoSince that user didn't specify them, what would you view as these warts?
- klibertp 8y agoIt has 3 (4?) different, not very compatible stdlibs, for example. Also 3 tools for syntactic extension, two of which suck incredibly, while the last one is pretty new. It has 2 (3 if you count Reason) very different syntaxes defined, even though I've never seen the "light" kind in the wild. The whole String mutability story is interesting in its own right. I'm sure there's a lot more. But note: every single language has warts like this, especially if it's been developed for a couple of years already. I think OCaml has probably fewer warts than JavaScript, or PHP, or even Java; but more than Go, or Elixir, or Scheme. It's still very nice language and toolchain, though, perfectly usable in many cases - the learning curve may be steep at some points, but on average it's not that hard to learn, and you gain a lot of benefits if you do.
- jdonaldson 8y agoOCaml is a great pick for folks wanting to broaden their understanding of prog languages. It has its own set of sensibilities (Fp with some imperative features thown in, rather than the other way around). It'll force you to get really good with ADTs, which is a good thing.
- krick 8y agoIs there something you'd recommend for a person who wants to learn OCaml? Maybe some book that has great exercises, or just a toy-project example for which OCaml would be a much more "natural" pick than other languages?
- PirateBay 8y agoIf you want to wait a little, the "Real World Ocaml" book is being re-written. It's in beta-ish right but it looks like it would be usable. Though the core language is the same, some of the language metaprogramming features have been totally switched out for other (better) ones. And it uses the modern versions of the Core (note, that is NOT the standard library) library.
- laylomo2 8y agoCheck out dev.realworldocaml.org
- jdonaldson 8y agoYes, this would be the book I would recommend as well. I'll give a bunch of general advice as well: OCaml is pretty old (introduced a year after Java IIUC), and it contains quite a few crusty libraries and programming patterns that come from age. Stick with the latest version you can find through this "modernization" process headed up by JS. I'm on 4.06, which just made immutable strings a default, and broke a ton of libraries. If you run into a broken lib, this recent version change is almost certainly the reason. I strongly recommend 4.06 as a minimum version (if you're not working with legacy code). If there's a library you want to use that is not compatible yet, bug the maintainer to update it. I've run into problems trying to downgrade/upgrade my compiler version + all the tools. I can't recommend doing that, it kinda ruins the experimentation experience. What else can I say? Opam, the package maintainer, is great. There's a great build system, nice IDE support with a set of tools called merlin, and the compiler is super fast. The compiler field-level error messages are generally helpful (typo-fix suggestions), but can be fiendishly opaque if you happen to mess up a match boundary (which can happen easily when mixing in if/then/else statements). Most stuff is google-able, but there's a lot of "line noise" in OCaml function signatures - especially for variant types and labeled arguments. That's harder to search for, so read that section thoroughly in the book.
- a0 8y agoIt's really great seeing this contributions from JaneStreet. If you're interested in learning more about recent progress in the OCaml's ecosystem, I recommend watching this talk: https://www.infoq.com/presentations/ocaml-browser-iot https://www.infoq.com/presentations/ocaml-browser-iot
- peeyek 8y agoThey should focus on developer tooling for wide adoption. More OCaml dev, win win situation for jane street.
- losvedir 8y agoHow's the performance of OCaml, and what's its concurrency story? I feel like on paper, at least, OCaml ticks all the boxes on my programming language wishlist: non-nullability, ADTs, type inference, compiles to binary. A lot like rust but a little higher level. But I've never really had a go at it. I'm sort of reluctant to sink time in it if there's not a future, but it seems to be kind of chugging along, not really gaining or losing ground, AFAICT.
- HumanDrivenDev 8y agoAs a language, it's great. As a real world environment/eco-system to get stuff soon? I've been waiting for it to get there for years, and it still hasn't. I check in every 12 months or so, am reminded how nice the language is, and quickly abandon ship when I realise how annoying it is to actually develop software.
- deleted 8y ago[deleted]
- chrisseaton 8y ago> what's its concurrency story I think concurrency is fine (threads and async are options) but parallelism still seems to always be just around the corner and never actually here. I understand part of the problem is making their GC able to handle parallel allocations without hurting basic allocation performance more than they're willing to do.
- klibertp 8y agoThe concurrency story is similar to what you get in Python. On one hand, you have event loop implementations with various conveniences for scheduling callbacks (Async, LWT); on the other, you have OS-level threads, but the runtime system has a global lock which makes only one thread execute at a given time. So no parallelism without forking[1] to separate processes. Moreover, the interactions between an event loop and OS-level threads which sometimes arise are non-trivial and in my experience very hard to get right, even with the helpers in Async. Single-threaded performance is generally good when natively compiled. In a benchmark I did a few years back, which consisted of traversing the filesystem with `opendir`, `readdir` and friends, OCaml was minimally slower than C++ and Nim (when compiled natively) and around Python and Racket when byte-compiled. It probably would be even faster if I used its imperative features. Looking at the code today I also see some unnecessary copying of lists, which could be mitigated. All in all, I think OCaml has a really good performance considering its high-level semantics. You have to be aware of relative costs of operations, but if you do, "as fast as C" is certainly attainable. OCaml code for the benchmark: https://klibert.pl/posts/walkfiles-ocaml.html https://klibert.pl/posts/walkfiles-ocaml.html and the results: https://klibert.pl/statics/images/walkfiled_perf_test1.png https://klibert.pl/statics/images/walkfiled_perf_test1.png [1] Actually, I just checked and it looks that `fork` is not implemented, so copy-on-write memory sharing is impossible, even on POSIX systems. Docs: http://caml.inria.fr/pub/docs/manual-ocaml/libunix.html http://caml.inria.fr/pub/docs/manual-ocaml/libunix.html http://caml.inria.fr/pub/docs/manual-ocaml/libref/Unix.html http://caml.inria.fr/pub/docs/manual-ocaml/libref/Unix.html
- useranme 8y agoIs there anything OCaml can do that no other language can do?
- a0 8y agoThe most unique feature is the type system which allows you to both model domain problems effectively and guarantee consistency. This reduces a huge number of bugs in compile-time.
- totalperspectiv 8y agoWhen I tried to really get into ocaml a few months ago I loved it! Until I actually tried to put together a project with it. Every tutorial and doc seemed to be slightly out of date or not compatible with some package version. Real World Ocaml, while excellent conceptually, is between versions and most examples were broken. I reeeaaalllly wanted to love Ocaml, but it just seemed like a collection of half baked tools and limited library support. So I learned Julia instead. I would love to see a little unification and life come into ocaml to get its dev tooling up to par with other modern languages. I gave up on it when I realized I had been spending more time debuging example code and conflicting versions of 'stdlib' type packages than i had been actually writing any Ocaml code.
- _hardwaregeek 8y agoLanguage ergonomics is a really underrated feature. I remember having to link system libraries to follow an OCaml tutorial, which was extremely painful. Or running into issues installing Snap for Haskell where the package manager would basically go ¯\_(ツ)_/¯. While on the other hand Cargo has been a breeze to set up and work. Makes all the difference when your users aren't willing to dive into the source code to fix the issue or wait for a StackOverflow/GitHub Issue response.
- orbifold 8y agoI am sure this is why the majority of software in use today is written in programming languages with great ergonomics such as C/C++ or Java. Besides you can’t use cargo once you are not developing a green field project and multi-language ergonomics can totally suck.
- openplatypus 8y agoOpam combined with Oasis (https://ocaml.org/learn/tutorials/setting_up_with_oasis.html https://ocaml.org/learn/tutorials/setting_up_with_oasis.html) does pretty good job IMO. My personal issue with OCaml eco-system is that for quality tooling Emacs feels like the only option.
- 8y ago
- xvilka 8y agoHopefully multicore OCaml will land into the mainline eventually. In my opinion it is the biggest issue against Rust or Haskell.
- ernst_klim 8y agoGreat, I'm using OCaml for a production code and it's the most pleasant programming experience I had so far.