5 ms·
A few weeks ago I started learning OCaml via Real World OCaml. However, I became concerned when I discovered that there are multiple competing "standard librari
by muraiki 11y ago
A few weeks ago I started learning OCaml via Real World OCaml. However, I became concerned when I discovered that there are multiple competing "standard libraries" and that there are also two different competing async frameworks. It looks like work is being done to ensure that the async frameworks are interoperable, but the existence of various standard libraries is worrisome to me.
In particular, while the one used in RWO (Core) seems very nice, it looks like its use of named parameters is via some kind of syntax extension (edit: not the case; see LeonidasXIV's reply). This seems to be a pretty large difference in approach, and while I can appreciate the reasons behind using named parameters in Core, it makes me worried about writing code that might have to interact across different stdlibs.
As such, I've decided to hold off on learning OCaml for now until resolutions to these community issues can be made more clear. But perhaps I just prefer the Python approach, and that may not be the same objective as those in OCaml.
Edit: Actually, the nail in the coffin was probably when I found a web framework that I wanted to use, but then the author explained why he was removing support for both of the async frameworks and going with only one of them (the one that RWO doesn't use). And then the other main web framework I found also used non-RWO async... :(
- joshmarlow 11y agoI started learning OCaml about a year ago (started with "OCaml from the very beginning" and moved onto "Real World OCaml"). The different extended standard libraries (Batteries and Core) gave me pause too. I'm by no means an active part of the community, but I feel like everything is moving toward Core (and I prefer it to Batteries anyway).
- pauldirac137 11y agoNamed parameters in Ocaml are not a syntax extension. http://caml.inria.fr/pub/docs/manual-ocaml/lablexamples.html#sec42 http://caml.inria.fr/pub/docs/manual-ocaml/lablexamples.html...
- richard_todd 11y agoThe multiple standard libraries thing also really cooled my enthusiasm last time I investigated the language. They really need to resolve that, or at least explain on their website why a newbie should not be concerned.
- LeonidasXIV 11y ago> it looks like its use of named parameters is via some kind of syntax extension No worries, OCaml natively supports named (and optional) parameters. What Core does, though, is reshuffle many function signatures to be more useful when using those parameters. I suppose you're talking about this[0] blog post, his reasons are pretty clear: hardly anybody uses Async apart from Jane Street, whereas Lwt is much more popular, used by standalone projects, many bindings, as well as Mirage. The reason RWO used Async is that it is basically a companion to Core and one of the authors of the book is also the author of both Core and Async. [0]: http://rgrinberg.com/blog/2014/12/11/abandoning-async/ http://rgrinberg.com/blog/2014/12/11/abandoning-async/
- muraiki 11y agoI'm sorry for misunderstanding OCaml's built in support for named/optional params. The problem with Async is that what seems to be the best resource for learning OCaml in 2016 teaches Async, not Lwt. I was excited to use it until I discovered that many things I was interested in use Lwt instead. It's not hard to learn Lwt, but this discovery made me think about the problems I've had as a professional Perl programmer in dealing with Perl 5's multiple competing event loops.
- LeonidasXIV 11y agoI can completely understand your worries and I agree that it is rather inconvenient, esp. since Lwt does not have a great introduction to start with. The upside is that with the hopefully soon upcoming algebraic effects that are supposed to appear in OCaml sooner or later, Lwt and Async might end up being obsoleted or subsumed into a compatible set of Async primitives.
- thedufer 11y agoFWIW, the current preferred web server at JS seems to be https://github.com/mirage/ocaml-cohttp https://github.com/mirage/ocaml-cohttp (which supports both Async and Lwt). I wouldn't go so far as to call it a framework, though.