Em Seg, 2009-02-16 às 17:28 +1100, Timothy S. Nelson escreveu: > Say I wanted to write a POP3 server. I want to receive a username and > password from the client. I want things to be interruptable during this, but > it's also impossible to sensibly roll things back like they were before the > connection was opened. Is this possible with the concurrency model you > specified?
The things you're describing are from the time when we were assuming STM (Software Transactional Memory) would be used by every implementation of Perl 6. Things have changed a bit in the last months, as STM seems a bit more challenging then it looks at first sight for a language as complex as Perl 6, specially if you think about lazyness. OTOH, the problem POE solves is the lack of a good "green threads" implementation in perl 5, which I think is not a problem for Perl 6 (I can say that for sure about SMOP, but I'm pretty sure that is also valid for parrot). In that specific area of writing network servers, I've been with a fixed idea about providing autothreading code, so you can write code that looks like 'imperative block-wait programming', but is actually 'async non-blocking programming'. I'll paste my last sketch about it here: my $io = Net::TCP.listen(:host<localhost>, :port(1234)); $io does IO::Async[EV]; $io.accepts: -> $conn { my %headers; my $data; my $waiting_headers = 1; for =$conn -> $line { if ($line && $waiting_headers) { my ($name, $val) = split(/\s*:\s*/, $line); $headers{$name} = $val; } elsif ($line) { $data ~= $line; } else { $waiting_headers = 0; } } $conn.write("200 OK\n\nSucessfull request\n"); }; EV.loop; daniel