[Phoenix-pm] More: Coro(utine) support from the perl core

Scott Walters scott at illogics.org
Thu Mar 9 07:27:47 PST 2006


----- Forwarded message from Marc Lehmann <schmorp at schmorp.de> -----

Return-Path: perl5-porters-return-110516-scott=slowass.net at perl.org
X-Original-To: scott at slowass.net
Delivered-To: scott at slowass.net
Received: from lists.develooper.com (x6.develooper.com [63.251.223.186])
	by slowass.net (Postfix) with SMTP id DEC76553AA
	for <scott at slowass.net>; Thu,  9 Mar 2006 14:52:31 +0000 (GMT)
Received: (qmail 28123 invoked by uid 514); 9 Mar 2006 14:45:29 -0000
Mailing-List: contact perl5-porters-help at perl.org; run by ezmlm
Precedence: bulk
list-help: <mailto:perl5-porters-help at perl.org>
list-unsubscribe: <mailto:perl5-porters-unsubscribe at perl.org>
list-post: <mailto:perl5-porters at perl.org>
X-List-Archive: <http://nntp.perl.org/group/perl.perl5.porters/110516>
List-Id: <perl5-porters.perl.org>
Delivered-To: mailing list perl5-porters at perl.org
Received: (qmail 28111 invoked from network); 9 Mar 2006 14:45:29 -0000
Delivered-To: perl5-porters at perl.org
X-Spam-Status: No, hits=-2.6 required=8.0
	tests=BAYES_00,SPF_HELO_PASS,SPF_PASS
X-Spam-Check-By: la.mx.develooper.com
Received-SPF: pass (x1.develooper.com: domain of root at schmorp.de designates 193.108.181.162 as permitted sender)
Date: Thu, 9 Mar 2006 15:45:12 +0100
From: Marc Lehmann <schmorp at schmorp.de>
To: perl5-porters at perl.org
Subject: Re: Coro(utine) support from the perl core
Message-ID: <20060309144512.GA22421 at schmorp.de>
References: <20060309010716.GA13267 at schmorp.de> <20060309083910.GI6272 at woobling.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20060309083910.GI6272 at woobling.org>
X-PGP: "1024D/DA743396 1999-01-26 Marc Alexander Lehmann <schmorp at schmorp.de>
       Key fingerprint = 475A FE9B D1D4 039E 01AC  C217 A1E8 0270 DA74 3396"

On Thu, Mar 09, 2006 at 10:39:10AM +0200, Yuval Kogman <nothingmuch at woobling.org> wrote:
> Please give some thought into making these serializable... I'm not

You can't, in principle, serialise those, unless you are in the same
process and keep the state, and even then, its only possible when you
ignore scoping issues.

Agni, for example, already supports continuations for use in a webserver
for a long time:

   slink "click me", {: die "You followed the link!\n" :}();

It does so by compiling all relevant code in all web server processes and
binding by md5(sourcecode). This doesn't always work (e.g. when the code
has been changed), of course, and it isn't properly scoped:

   my $var;
   slink "click me", {: $var++ :}();

Should work, but cannot, as there is no way to associate the $var inside the
{: :} with the outside $var.

This happens with simple code references already. With coroutines, it becomes
even more problematic.

The problem is simply unsolvable in _principle_, unless you throw away
some features, such as closures and the ability to load references into a
different process that saved them (which would make them rather pointless,
but would certainly be implementable in some or another form, but would
amount to simple storing of the reference for later use and serialising a
reference "ID").

The simple case can already be done using e.g. Storable.

-- 
                The choice of a
      -----==-     _GNU_
      ----==-- _       generation     Marc Lehmann
      ---==---(_)__  __ ____  __      pcg at goof.com
      --==---/ / _ \/ // /\ \/ /      http://schmorp.de/
      -=====/_/_//_/\_,_/ /_/\_\      XX11-RIPE
----- End forwarded message -----


More information about the Phoenix-pm mailing list