From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 0E6717FDF3 for ; Mon, 7 Mar 2016 08:16:38 +0100 (CET) IronPort-PHdr: 9a23:yFToCBZuQFTvZ89MyN9MZuj/LSx+4OfEezUN459isYplN5qZpcuybnLW6fgltlLVR4KTs6sC0LqJ9fC4Ej1fqb+681k8M7V0HycfjssXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aJBzzOEJPK/jvHcaK1oLsh7/0q8WYMloArQH+SI0xBS3+lR/WuMgSjNkqAYcK4TyNnEF1ff9Lz3hjP1OZkkW0zM6x+Jl+73YY4Kp5pIZoGJ/3dKUgTLFeEC9ucyVsvJWq5lH/Sl6+4WcVVy08mwBOBBmNuAD9Qp70uCLgsO1s8CafNMzyC7szXGLxwb1sTUrNgSMMMDo8uETelsV0j6sT9BekrgB2x43dSI6QPft6OKjaeIVJFiJ6Qs9NWnkZUcuHZIwVAr9EZL4Aog== Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=mmatalka@gmail.com; spf=Pass smtp.mailfrom=mmatalka@gmail.com; spf=None smtp.helo=postmaster@mail-wm0-f45.google.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of mmatalka@gmail.com) identity=pra; client-ip=74.125.82.45; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="mmatalka@gmail.com"; x-sender="mmatalka@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of mmatalka@gmail.com designates 74.125.82.45 as permitted sender) identity=mailfrom; client-ip=74.125.82.45; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="mmatalka@gmail.com"; x-sender="mmatalka@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-wm0-f45.google.com) identity=helo; client-ip=74.125.82.45; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="mmatalka@gmail.com"; x-sender="postmaster@mail-wm0-f45.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CTAAB0Kt1Wji1SfUpdhGoPqEOSC4Fphg8CgSE6EgEBAQEBAQEBEAEBAQEHCwsJHzGCLYIVAQEDARIuARsdAQMBCwYFCxYlDwEEDQIRAQUBIhMih2oBAwoIBKJWgTE+MY0ggleFAgoZJw1Rg3YBAQEBAQEBAQIBAQEBAQEUAQUKBIQEggWEPYI9hjcFlyqLeIF1iRuFX4cMhgsvgQ8mAYIxChQIgUhqiT0BAQE X-IPAS-Result: A0CTAAB0Kt1Wji1SfUpdhGoPqEOSC4Fphg8CgSE6EgEBAQEBAQEBEAEBAQEHCwsJHzGCLYIVAQEDARIuARsdAQMBCwYFCxYlDwEEDQIRAQUBIhMih2oBAwoIBKJWgTE+MY0ggleFAgoZJw1Rg3YBAQEBAQEBAQIBAQEBAQEUAQUKBIQEggWEPYI9hjcFlyqLeIF1iRuFX4cMhgsvgQ8mAYIxChQIgUhqiT0BAQE X-IronPort-AV: E=Sophos;i="5.22,550,1449529200"; d="scan'208";a="167375585" Received: from mail-wm0-f45.google.com ([74.125.82.45]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 07 Mar 2016 08:16:37 +0100 Received: by mail-wm0-f45.google.com with SMTP id p65so95499343wmp.1 for ; Sun, 06 Mar 2016 23:16:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=Wq048GHsX4vRBSTVwdTnJ33lMwrHN+/Wl17+ULTeZgk=; b=TgBpIv34O1rMXMqTMwvCdfUZDSyI4uWzRkGAZpXsXd5eNNzBBmZkgDxQNhwDDw2qbl E/3c/8temB50dDvhNWkBQIkzlcN9LJRaMOpaDU6ECCCEqD7JWivighULbeEuh61O01CZ zLLQGI7FBDI92cT4W5sEzzUc7KKXxdzAswuiV7zJQD8CKVnu7gXanmp3sMWKr20TF6Sz FKpyv8flp2iULktdGu4g+EpuxB9/HyykWjqXY3yxrxYPrr+HsV4KL5iDd5AR8+1qZ1d6 YmZurrd9YS1mpB/M0cuae04Yhig+OfhK3yig0FCDb4Ta0GTW96KfuCNKg0xBODZrVw6v qKKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=Wq048GHsX4vRBSTVwdTnJ33lMwrHN+/Wl17+ULTeZgk=; b=ch1Nr3/zDVrEo2afHSAplRKkBEOQYCG4MJpKllNNiIY2M4EXH2N9e0EQZPyZe6CcD8 Bl7JQDYp2qtdFVDR5NsCNe7dGkheT3OnIRfEcx3G13WGCjFZd+OzZqWiSyih6sjTtnFu INwUJqeIMGD1qo3sdAaXGCMMUkm1dY21bKp7Ppgoba3PKZKzWYF4OqEZIGkZjtN7gUv0 R47eR6OZmWRvcM5zgY6VSgR5NWtC0+4JKLmp7T9moiA++fNWHG/531dsWmoPDobSLFjw qOUgE53BXhxKMmlVwuvUlv56o4wYzs8QJaZecivSj5k6SmM0KF2+vnGn/ApzXfZCkuWK Ov9Q== X-Gm-Message-State: AD7BkJIJJQIVMYgLG9+oJstpWCZX93lNID7h5X9NWL5GQveMRb0H6g51GLNNQHl3dPyt3Q== X-Received: by 10.28.109.141 with SMTP id b13mr10421272wmi.25.1457334997088; Sun, 06 Mar 2016 23:16:37 -0800 (PST) Received: from localhost ([37.153.108.22]) by smtp.gmail.com with ESMTPSA id up6sm16450163wjc.6.2016.03.06.23.16.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 06 Mar 2016 23:16:36 -0800 (PST) From: Malcolm Matalka To: Yotam Barnoy Cc: Ocaml Mailing List References: Date: Mon, 07 Mar 2016 07:16:14 +0000 In-Reply-To: (Yotam Barnoy's message of "Sun, 6 Mar 2016 20:38:32 -0500") Message-ID: <86oaaqahc1.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Caml-list] Question about Lwt/Async Yotam Barnoy writes: > Hi all > > I'm thinking about my next project in OCaml, and I'm wondering how many > users of OCaml currently use Lwt or Async regularly. > > One of the advantages of OCaml over Haskell (which I'm not crazy about) is > the fact that you don't have to constantly be stuck inside a monad. > However, once you want to use these user-level threading libraries, you're > essentially tied to a monad. It also means that the usage of any other > monad from Lwt/Async code is out -- OCaml doesn't have the monad > transformer infrastructure to layer monads easily as far as I can tell (am > I wrong?). I mean, even in Haskell using Monad Transformers is a pain (IMO). > > Also, what happens to general utility functions that aren't rewritten for > Async/Lwt -- as far as I can tell, being in non-monadic code, they will > always starve other threads, since they cannot yield to another Async/Lwt > thread. Is this perception correct? If so, this seems to imply that you > either write your code to cooperate within these frameworks and suffer the > monad, or don't, and make it near-impossible for Lwt/Async users to make > use of your code. > > I would like to get an idea of the usage level of these libraries, as well > as the burden of writing compatible code, any difficulties etc. Also, I'd > like to get a sense of the domains that benefit from these libraries. Some > domains (such as gaming) traditionally involve a continuous main loop, and > would thus only suffer from the additional overhead of queuing in these > libraries. > > -Yotam I mostly use Async. However, I think most usage of Lwt or Async requires doing as little as possible in these frameworks and using them to orchestrate other functions. For example, I usually try to separate parsing of a network protocol from the reading and writing of the bytes.