[wg-parallel] About Lwt and Async

Jeremie Dimino jdimino at janestreet.com
Wed May 1 09:32:25 BST 2013

On Tue, Apr 30, 2013 at 6:25 PM, Daniel Bünzli
<daniel.buenzli at erratique.ch> wrote:
> To be honest I'm neither content with either lwt nor async. I actually toyed with my own implementation of these concepts, that may, or not, be released in the future. A few hints of what lead me to that are given here [1].

I am not surprised that not everybody is happy with lwt or async, you
are not the first one I know of to try his own implementation.  Also I
am always interested in feedback, so it is interesting to see
different ones.

> That being said I would like to stress that a lot of foundational libraries can avoid making a choice *without* functorizing as Yaron (doesn't) suggest.
> Notably codecs can be made both lwt and async friendly by following this pattern [2] (the repo has a toy example, see the readme), which I already implemented for Unicode and JSON decoding [3,4]; xmlm will adopt it once I get time to work on the library again; the Vg library on which I'm currently working on [5] also uses that pattern.

Well that works to some extent.  If you are doing no IO or just using
sockets it is easy to provide the user with what he needs to hook into
the asynchronous mechanism of his choice.  But the more you need from
the OS and the harder it gets.

> Given the positions on both sides, I actually think we should take that "schism" as a chance rather than a curse. Striving for independence from the concrete asynchronous programming mechanism (with or without functorizing) and cutting down on dependencies in foundational libraries may actually lead to software that is more composable, adaptable and reusable in the long term.
> My opinion is that most of the time choosing a particular asynchronous programming library should be a choice left to the developer of *applications* not to the developer of libraries --- but I have a bias towards small and focused libraries rather than "solve everything frameworks".

I guess the good thing about big integrated frameworks is that it is
quicker to develop applications with them.  You can just import them
and start using what you need without having to worry about
inter-component integration.

That said I agree with you that small independent libraries like yours
are a good thing.

More information about the wg-parallel mailing list