From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: John Cowan Newsgroups: gmane.lisp.guile.user Subject: Re: Guile fibers return values Date: Sat, 4 Jan 2020 21:42:21 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="142273"; mail-complaints-to="usenet@blaine.gmane.org" Cc: guile-user To: Zelphir Kaltstahl Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sun Jan 05 03:43:09 2020 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1invsh-000atN-N2 for guile-user@m.gmane.org; Sun, 05 Jan 2020 03:43:07 +0100 Original-Received: from localhost ([::1]:38584 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1invsg-0007El-IS for guile-user@m.gmane.org; Sat, 04 Jan 2020 21:43:06 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50641) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1invs8-0007DG-Gu for guile-user@gnu.org; Sat, 04 Jan 2020 21:42:33 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1invs7-0006RR-6h for guile-user@gnu.org; Sat, 04 Jan 2020 21:42:32 -0500 Original-Received: from mail-qt1-x82a.google.com ([2607:f8b0:4864:20::82a]:44391) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1invs6-0006NV-QB for guile-user@gnu.org; Sat, 04 Jan 2020 21:42:31 -0500 Original-Received: by mail-qt1-x82a.google.com with SMTP id t3so39879729qtr.11 for ; Sat, 04 Jan 2020 18:42:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ccil-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+y2OGwmf8EygCy3oX6U+EJrsO4IvBvjojorKTr7pukI=; b=r4ZktVliEomnxgMACuaGPQzgzgP5Q/k+FJo6SmJTGyU1qlSY5uvarQYHneT9w6zgGP keeNokMYBTzpkGPPWmFE/1WBWFoqUBrVMvn3ujjxOsKGqD6ZIBTrZqlsLku93p24MUXx ghHvGvgZ3RYp/hQqoNEkOxODGuC4laJDK/dhpxVAyQTjMlsA4mMqPK6PssK/ntVrRFv1 M4yBJj5k2kj8dEXkHbYOMH0zN4i06nxVdjyzazezv35giTeT78FTK+dV8r6+Fw3HMeka rKNgsXHxu/kFIwkA6CRDeMMCE01HlThNxNRrx+wAbgfymoIGbOspiUrtW7KbVJLXXGbN Pk+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+y2OGwmf8EygCy3oX6U+EJrsO4IvBvjojorKTr7pukI=; b=I0juMc53jaGWXDN6F69PyFT2frIyx0f+tySaCSBLWFrAZ7pOIfnW3Q4X41/s0M+diP BBhnPunhufTEBRoycV/r1Pfk3AN5XAd20CZia3KSKPJRp888pVTDiV0YVeLGlLaCLGTr PjiLVgELYft+G74x7KGF1uoGwDSaUvCRfj8rEWSS9v8BuqjWM5z2mde9lJ7sWWZOoOdy jX5omFVj6bseIcMtmLb/KF9gx0XrsHMgHwartRdLVGK91T8gdpFov1A0Zbi9mGRu4EUd 0LRlPHJy9BZH6qfbrjX4fvtWE22m/tVffLessszgrX/xpMugMR8BmTSmJnYCDiAmG+1Y y2rg== X-Gm-Message-State: APjAAAWGTKAe0tO9nSWNP7BChe0QvUxP5xxc7aivLnDTIHxaeWj1xWVT JEak0Staq2aduPo1tu5H7HBs+QtgQRTpulOThlROrA== X-Google-Smtp-Source: APXvYqzkQ/bT4+fkAQXYRSCVtjxrGieZqOe4IlSztIG70NuFjy1skwL0DNDMyPNbPAxh8XPZxRpEoYo1T/7VEzz6mZQ= X-Received: by 2002:ac8:3590:: with SMTP id k16mr66508805qtb.83.1578192149675; Sat, 04 Jan 2020 18:42:29 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::82a X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:15987 Archived-At: On Sat, Jan 4, 2020 at 5:50 PM Zelphir Kaltstahl wrote: I have questions regarding the usage of the fibers library. It seems, > that I cannot find any way to get a computation result back from a > fiber. I also cannot find anything about how to get a value back from a > fiber, except for channels. FIbers are much more like coroutines than subroutines: they don't return data, they pass it on. You *can* communicate by mutating shared data, but it's asking for trouble because of synchronization issues. Stick to communicating using channels, that's what they are for. Of course if your fiber both sends and receives on channels to the same fiber, you risk deadlock if you are not careful to stay exactly in sync and avoid output buffering. Exactly these rules apply to shell pipelines, probably the most widespread form of concurrency in programming as well as the simplest and most reliable. John Cowan http://vrici.lojban.org/~cowan cowan@ccil.org Deshil Holles eamus. Deshil Holles eamus. Deshil Holles eamus. Send us, bright one, light one, Horhorn, quickening, and wombfruit. (3x) Hoopsa, boyaboy, hoopsa! Hoopsa, boyaboy, hoopsa! Hoopsa, boyaboy, hoopsa! --Joyce, Ulysses, "Oxen of the Sun"