RFC: Implicit threading and Implicit event-loop (Was: Re: Continuations)

2009-05-27 Thread Daniel Ruoso
. In particular, threading junctions through conditionals correctly could involve continuations, which are almost but not quite mandated in Perl 6.0.0. What is a continuation? Continuation here is meant in the most generic sense, which is: The rest of the thread of execution It doesn't imply any

Re: Continuations

2009-05-27 Thread Jon Lang
Andrew Whitworth wrote: The issue mentioned in the Synopses is that junctions autothread, and autothreading in a conditional could potentially create multiple threads of execution, all of which are taking different execution paths. At some point, to bring it all back together again, the

Re: RFC: Implicit threading and Implicit event-loop (Was: Re: Continuations)

2009-05-27 Thread John M. Dlugosz
to change over time; it is therefore erroneous to pass junctions to any control construct that is not implemented via as a normal single or multi dispatch. In particular, threading junctions through conditionals correctly could involve continuations, which are almost but not quite mandated in Perl 6.0.0

Continuations

2009-05-26 Thread Jon Lang
junctions through conditionals correctly could involve continuations, which are almost but not quite mandated in Perl 6.0.0. What is a continuation? -- Jonathan Dataweaver Lang

Re: Continuations

2009-05-26 Thread John M. Dlugosz
single or multi dispatch. In particular, threading junctions through conditionals correctly could involve continuations, which are almost but not quite mandated in Perl 6.0.0. What is a continuation? http://en.wikipedia.org/wiki/Continuation Early on, Perl 6 discussion featured a lot

Re: Blocks, continuations and eval()

2005-04-22 Thread Stéphane Payrard
Hi, I am making a presentation about Perl6 this week end. My point will be: the next generation of applicative languages will be scripting languages because they have come of age. Alternatives don't cut it anymore. Indeed C and C++ are memory allocation nightmare; Java and C# don't have

Re: Blocks, continuations and eval()

2005-04-22 Thread Stéphane Payrard
On Fri, Apr 22, 2005 at 08:13:58PM +0200, Stéphane Payrard wrote: On Fri, Apr 22, 2005 at 09:32:55AM -0700, Larry Wall wrote: Thank you for your detailled answer. I still don't get what you mean by [] pattern matching arguments. Do you mean smart pattern matching on composite values?

Re: Blocks, continuations and eval()

2005-04-21 Thread wolverian
On Tue, Apr 12, 2005 at 04:17:56AM -0700, Larry Wall wrote: We'll make continuations available in Perl for people who ask for them specially, but we're not going to leave them sitting out in the open where some poor benighted pilgrim might trip over them unawares. Sorry for replying so late

Re: Blocks, continuations and eval()

2005-04-21 Thread Larry Wall
On Thu, Apr 21, 2005 at 04:30:07PM +0300, wolverian wrote: : On Tue, Apr 12, 2005 at 04:17:56AM -0700, Larry Wall wrote: : We'll make continuations available in Perl for people who ask for : them specially, but we're not going to leave them sitting out in the : open where some poor benighted

Re: Blocks, continuations and eval()

2005-04-21 Thread Nigel Sandever
On Thu, 21 Apr 2005 08:36:28 -0700, [EMAIL PROTECTED] (Larry Wall) wrote: Hmm, maybe that's not such a bad policy. I wonder what other dangerous modules we might have. Ada had UNCHECKED_TYPE_CONVERSION, for instance. How about use RE_EVAL; # or should that be REALLY_EVIL? Larry

Re: Blocks, continuations and eval()

2005-04-12 Thread Larry Wall
unclear. : : Can you tell me what your idea of a scope is? I'm thinking a : continuation, and if that is what you are thinking, I'm thinking the : answer to your question is yes. : : Yes. I want to know how Perl 6 exposes continuations, and how to get one : for, say, the current lexical scope

Re: Blocks, continuations and eval()

2005-04-12 Thread Piers Cawley
. : : That is what I'm wondering about. I'm sorry I was so unclear. : : Can you tell me what your idea of a scope is? I'm thinking a : continuation, and if that is what you are thinking, I'm thinking the : answer to your question is yes. : : Yes. I want to know how Perl 6 exposes continuations, and how

Blocks, continuations and eval()

2005-04-08 Thread wolverian
on coderefs or blocks. Is there a difference between the two? I always hated this about Ruby; there seems to be no practical value to the separation. Also, are blocks/coderefs/scopes continuations? Should .eval be a method in Continuation? Thanks, -- wolverian signature.asc Description

Re: Blocks, continuations and eval()

2005-04-08 Thread David Storrs
On Fri, Apr 08, 2005 at 05:03:11PM +0300, wolverian wrote: Hi wolverian, one day a friend asked if Perl 5 had a REPL facility. (Read-Eval-Print-Loop). I told him it has perl -de0, which is different [...] In Perl 6, the generic solution to fix this (if one wants to fix it) seems, to me, to

Re: Blocks, continuations and eval()

2005-04-08 Thread MrJoltCola
continuations? Should .eval be a method in Continuation? I'm having a bit of trouble following you, but I can tell you that the VM portion treats continuations as well as lexical scopes or pads as first class Parrot objects (or PMCs). I cannot say how much Perl6 will expose to the high level

Re: Blocks, continuations and eval()

2005-04-08 Thread wolverian
to scopes programmatically. I'm also asking if they are continuations, or blocks, or coderefs, or are those all the same? The two things you mention are effects of being able to refer to scopes in such a fashion. I do want both, but the real question isn't if they are possible, but about what blocks

Re: Blocks, continuations and eval()

2005-04-08 Thread wolverian
are thinking, I'm thinking the answer to your question is yes. Yes. I want to know how Perl 6 exposes continuations, and how to get one for, say, the current lexical scope, and if it has a method on it that lets me evaluate code in that context (or some other way to do that). -Melvin -- wolverian

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-20 Thread Dan Sugalski
At 12:00 AM + 3/20/03, Simon Cozens wrote: [EMAIL PROTECTED] (Matthijs Van Duin) writes: OK, I suppose that works although that still means you're moving the complexity from the perl implementation to its usage: in this case, the perl 6 parser which is written in perl 6 No, I don't believe

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-20 Thread Austin Hastings
a variable, and should not be undone by this. (Of course, if unwinding the call stack causes the variable to go out of scope, it's not an issue.) continuation: goto - Again: continuations are transfers of control, not data. If let

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-20 Thread Matthijs van Duin
posts an example of why. No problem since it works fine in my model (I had already mentioned that earlier) - I just said *I* don't see why anyone would.. :-) So, stop talking about rexen. When everyone groks how continuations should work, it'll fall out. rexen were the main issue: Dan was worried

Re: prototype (was continuations and regexes)

2003-03-20 Thread Matthijs van Duin
On Thu, Mar 20, 2003 at 11:38:31AM -0800, Sean O'Rourke wrote: Here's what I take to be a (scheme) prototype of Matthijs' success continuations approach. It actually works mostly by passing closures and a state object, ... Matthijs -- is this what you're describing? It sounds like approach #2

Re: prototype (was continuations and regexes)

2003-03-20 Thread Matthijs van Duin
Oops, I just noticed Sean had mailed Dan and me privately, not on the list.. sorry for sending the reply here :-) -- Matthijs van Duin -- May the Forth be with you!

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Matthijs van Duin
returned. Are you saying every rule will be an explicit state machine? This has the advantage that Clet behaves consistently with the rest of Perl What do you mean? I looked around in Parrot a little, and it seems like continuations are done pretty efficiently. Yes, I noticed that do

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Leopold Toetsch
Matthijs van Duin wrote: Which system is likely to run faster on parrot? I would propose, estimate the ops you need and test it :) E.g. call a continuation 1e6 times and communicate state with one global (a lexical is probably the same speed, i.e. a hash lookup) $ cat a.pasm new P5,

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Matthijs van Duin
On Wed, Mar 19, 2003 at 10:38:54AM +0100, Leopold Toetsch wrote: I would propose, estimate the ops you need and test it :) Hmm, good point Or even better.. I should just implement both examples and benchmark them; they're simple enough and the ops are available. I guess it's time to familiarize

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Matthijs van Duin
On Wed, Mar 19, 2003 at 01:01:28PM +0100, Matthijs van Duin wrote: On Wed, Mar 19, 2003 at 10:38:54AM +0100, Leopold Toetsch wrote: I would propose, estimate the ops you need and test it :) Hmm, good point Or even better.. I should just implement both examples and benchmark them; they're simple

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Matthijs van Duin
that the results I may find in these tests are unlikely to have any relation to the performance of rules in practice. 1. making continuations affects the performance of *other* code (COW) 2. the let operation is missing and all attempts to fake it are silly 3. to really test it, I'd need to make

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Dan Sugalski
so much a subroutine as a macro. For this to work, if we had: foo: \w+? bar: [plugh]{2,5} then what the regex engine *really* got to compile would be: (\w+?) ([plugh]{2,5}) with names attached to the two paren groups. Treating them as actual subroutines leads to madness, continuations

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Matthijs van Duin
{ alpha+? } } What you say is only allowed if I put is inline on foo. continuations don't quite work Care to elaborate on that? I'd say they work fine We do, after all, want this fast, right? Ofcourse, and we should optimize as much as we can - but not optimize *more* than we can. Rules need

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Dan Sugalski
but the update won't take effect until after the end of the regex, the same way that you can't redefine a sub you're in the middle of executing. (And yes, I'm aware that if you do that you'll pick up the new version if you recursively call, but that won't work with regexes) continuations don't

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Matthijs van Duin
this, I think we should be careful with introducing mandatory restrictions just to aid optimization. (is inline will allow such optimizations ofcourse) There's issues with hypothetical variables and continuations. (And with coroutines as well) While this is a general issue, they come up most

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Leopold Toetsch
Matthijs van Duin wrote: sweepoff# or bus error collectoff# or segmentation fault Please try : /* set this to 1 for tracing the system stack and processor registers */ #define TRACE_SYSTEM_AREAS 1 in dod.c (works for me). Though I don't know, if processor registers on PPC gets

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Jonathan Scott Duff
On Wed, Mar 19, 2003 at 11:09:01AM -0500, Dan Sugalski wrote: By the time the regex is actually executed, it's fully specified. By definition if nothing else--you aren't allowed to selectively redefine rules in the middle of a regex that uses those rules. Or, rather, you can but the update

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Sean O'Rourke
On Wed, 19 Mar 2003, Jonathan Scott Duff wrote: Are you implying that $fred = rx/fred/; $string ~~ m:w/ $fred { $fred = rx/barney/; } rubble / won't match barney rubble? Or, worse, that $fred = rx/fred/; $string ~~ m:w/ { $fred = rx/barney/; } $fred rubble /

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Dan Sugalski
At 10:41 AM -0600 3/19/03, Jonathan Scott Duff wrote: On Wed, Mar 19, 2003 at 11:09:01AM -0500, Dan Sugalski wrote: By the time the regex is actually executed, it's fully specified. By definition if nothing else--you aren't allowed to selectively redefine rules in the middle of a regex that

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Dan Sugalski
execution. Yes, I may lose, but if I don't try... My job, after all, is to make it go fast. If you want something that'll require things to be slow then I don't want you to have it. :) There's issues with hypothetical variables and continuations. (And with coroutines as well) While this is a general

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Simon Cozens
[EMAIL PROTECTED] (Dan Sugalski) writes: you aren't allowed to selectively redefine rules in the middle of a regex that uses those rules. This is precisely what a macro does. -- How should I know if it works? That's what beta testers are for. I only coded it. (Attributed to Linus Torvalds,

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Dan Sugalski
At 5:47 PM + 3/19/03, Simon Cozens wrote: [EMAIL PROTECTED] (Dan Sugalski) writes: you aren't allowed to selectively redefine rules in the middle of a regex that uses those rules. This is precisely what a macro does. Not once execution starts, no. --

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Simon Cozens
[EMAIL PROTECTED] (Dan Sugalski) writes: At 5:47 PM + 3/19/03, Simon Cozens wrote: [EMAIL PROTECTED] (Dan Sugalski) writes: you aren't allowed to selectively redefine rules in the middle of a regex that uses those rules. This is precisely what a macro does. Not once execution

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Dan Sugalski
At 5:54 PM + 3/19/03, Simon Cozens wrote: [EMAIL PROTECTED] (Dan Sugalski) writes: At 5:47 PM + 3/19/03, Simon Cozens wrote: [EMAIL PROTECTED] (Dan Sugalski) writes: you aren't allowed to selectively redefine rules in the middle of a regex that uses those rules. This is

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Simon Cozens
[EMAIL PROTECTED] (Dan Sugalski) writes: Compilation's just execution of a regex, albeit the Perl6::Grammar::program regex, and that regex will need to be modified while it's in operation in order to pick up macro is parsed definitions and apply them to the rest of what it's parsing. Ah,

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Matthijs van Duin
On Wed, Mar 19, 2003 at 12:35:19PM -0500, Dan Sugalski wrote: Then I wasn't clear enough, sorry. This is perl -- the state of something at compile time is just a suggestion as to how things ultimately work. Yes, hence my surprise about actually inlining stuff, luckily that was just a

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Dan Sugalski
At 8:04 PM +0100 3/19/03, Matthijs van Duin wrote: On Wed, Mar 19, 2003 at 12:35:19PM -0500, Dan Sugalski wrote: I'll nudge Larry to add it explicitly, but in general redefinitons of code that you're in the middle of executing don't take effect immediately, and it's not really any different for

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Matthijs van Duin
, $z will be de-hypothesized and $y re-hypothesized. $x will be unaffected by all this and when hypotheticals are visible to other threads. I haven't thought of that, but to be honest I'm not a big fan of preemptive threading anyway. Cooperative threading using continuations is probably faster

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Dan Sugalski
at the time the continuation was taken or just re-hypotheticalize the variables? (Which makes continuations potentially more expensive as you need to then save off more info so on invocation you can restore the hypothetical state) What about co-routines, then? And does a yield from a coroutine

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Matthijs van Duin
something new. (Which makes continuations potentially more expensive as you need to then save off more info so on invocation you can restore the hypothetical state) Actually, I think 'let' can handle this.. it's only invocation of continuations that will become more expensive because it needs to deal

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Simon Cozens
[EMAIL PROTECTED] (Matthijs Van Duin) writes: OK, I suppose that works although that still means you're moving the complexity from the perl implementation to its usage: in this case, the perl 6 parser which is written in perl 6 No, I don't believe that's what's happening. My concern is that at

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Larry Wall
I would like to express my sincere gratitude to all of you for working through these issues. I bent my brain on the Perl 5 regex engine, and that was just a simple recurse-on-success engine--and I'm not the only person it drove mad. I deeply appreciate that Perl 6's regex engine may drive you

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-19 Thread Sean O'Rourke
push marks onto the regex stack before they return. I'm not sure if this can be made to work with hypotheticals, and I'm sure it won't interact kindly with continuation-taking, but there's _something_. As for the interaction with continuations, I was about to post some of my concerns when I

Rules and hypotheticals: continuations versus callbacks

2003-03-18 Thread Matthijs van Duin
for invoking subrules :-) Anyway, I will use the following grammar for examples: rule foo { a } rule bar { a+ } rule quux { ab } rule test { [ foo | bar ] quux } Mechanism 1 -- Continuations Continuations can be used to reset the state of the world to the previous

Re: Rules and hypotheticals: continuations versus callbacks

2003-03-18 Thread Luke Palmer
continuations are done pretty efficiently. So, I can't really say which of these would be faster, but I'd guess the latter. I'll be writing them both, though, so we'll see :) Luke

Ccaller and Continuations

2003-03-11 Thread Luke Palmer
=head1 Ccaller and Continuations Here's another blend known paradigms document from Luke. The idea is to rethink Ccaller to provide even more information than it already does, in an elegant way. To get us started: As in Perl 5, the Ccaller function will return information about

Re: Coroutines, continuations, and iterators -- oh, my! (Was: Re: Continuations elified)

2002-11-21 Thread fearcadi
Damian Conway writes: There's no second iterator. Just Cfor walking through an array. ( questions in the form of answers :-) so : * for impose array context for first argument and doesnt care about nature of the array which it was given eventually as an argument . no multiple

Re: Continuations

2002-11-20 Thread Damian Conway
Paul Johnson wrote: Is it illegal now to use quotes in qw()? Nope. Only as the very first character of a Paging Mr Cozens. ;-) It's just another instance of whitespace significance. print «\a b c»; Presumably without the backslash here too. Maybe. It depends on whether Larry

Re: Continuations elified

2002-11-20 Thread Damian Conway
Arcadi wrote: while $iter {...} # Iterate until $iter.each returns false? you mean Iterate until $iter.next returns false? Oops. Quite so. what is the difference between the Iterator and lazy array ? am I right that it is just interface : lazy array is an iterator object

Re: Coroutines, continuations, and iterators -- oh, my! (Was: Re: Continuations elified)

2002-11-20 Thread Damian Conway
definition of any sub-with-yield == coroutine) cause loss of desirable capability? No. Not compared to other potential coroutine semantics. 3b- Is there a corresponding linkage between continuations and some object, a la coroutine-iterator? Continuations can be used to implement virtually any

Re: Continuations

2002-11-19 Thread Paul Johnson
Damian Conway said: Is it illegal now to use quotes in qw()? Nope. Only as the very first character of a Paging Mr Cozens. ;-) So any of these are still fine: print a b c ; print \a b c; print «\a b c»; Presumably without the backslash here too. print

Re: Continuations

2002-11-19 Thread Austin Hastings
--- Damian Conway [EMAIL PROTECTED] wrote: Iain 'Spoon' Truskett wrote: @a ???+??? @b @a ???+??? @b Y'know, for those of us who still haven't set up Unicode, they look remarkably similar =) Think Of It As Evolution In Action ;-) This coming from someone whose national

Re: Continuations elified

2002-11-19 Thread fearcadi
Damian Conway writes: David Wheeler asked: How will while behave? Cwhile evaluates its first argument in scalar context, so: while $fh {...}# Iterate until $fh.readline returns EOF? More or less. Technically: call $fh.next and execute the loop body if that

Re: Coroutines, continuations, and iterators -- oh, my! (Was: Re: Continuations elified)

2002-11-19 Thread Austin Hastings
with were written in assembly language, so I don't really know anything about what they can be used to do.) 3b- Is there a corresponding linkage between continuations and some object, a la coroutine-iterator? 3c- Is there a tie between use of continuations and use of thread or IPC functionality

Re: Continuations

2002-11-18 Thread Ken Fox
Damian Conway wrote: my $iter = fibses(); for $iter {...} (Careful with those single angles, Eugene!) Operator isn't legal when the grammar is expecting an expression, right? The must begin the circumfix operator. Is the grammar being weakened so that yacc can handle it? The rule

Re: Continuations elified

2002-11-18 Thread Austin Hastings
--- Damian Conway [EMAIL PROTECTED] wrote: The semantics of Cfor would simply be that if it is given an iterator object (rather than a list or array), then it calls that object's iterator once per loop. By extension, if it is NOT given an iterator object, will it appear to create one? That

Re: Continuations

2002-11-18 Thread Damian Conway
Ken Fox wrote: Damian Conway wrote: my $iter = fibses(); for $iter {...} (Careful with those single angles, Eugene!) Operator isn't legal when the grammar is expecting an expression, right? Right. The must begin the circumfix operator. Or the circumfix ... operator.

Re: Continuations elified

2002-11-18 Thread Damian Conway
Austin Hastings asked: By extension, if it is NOT given an iterator object, will it appear to create one? Yep. That is, can I say for (@squares) { ... if $special.instructions eq 'Advance three spaces' { $_.next.next.next; } ... } or some other suchlike thing that will

Re: Continuations elified

2002-11-18 Thread Austin Hastings
--- Damian Conway [EMAIL PROTECTED] wrote: Austin Hastings asked: That is, can I say for (@squares) { ... if $special.instructions eq 'Advance three spaces' { $_.next.next.next; } ... } or some other suchlike thing that will enable me to consistently

Re: Continuations elified

2002-11-18 Thread Larry Wall
On Tue, Nov 19, 2002 at 08:53:17AM +1100, Damian Conway wrote: : my $dance = Iterator.new(@squares); : for $dance { Scalar variables have to stay scalar in list context, so $dance cannot suddenly start behaving like a list. Something must tell the scalar to behave like a list, and I

Re: Continuations elified

2002-11-18 Thread Damian Conway
Larry wrote: So you can do it any of these ways: for $dance { for $dance.each { for each $dance: { ^ note colon Then there's this approach to auto-iteration: my @dance := Iterator.new(@squares); for @dance { Okay, so now I need to make sense of the

Re: Continuations

2002-11-18 Thread Ken Fox
Damian Conway wrote: Ken Fox wrote: The must begin the circumfix operator. Or the circumfix ... operator. Which is the problem here. This is like playing poker with God. Assuming you can get over the little hurdles of Free Will and Omniscience, there's still the problem of Him pulling

Re: Continuations

2002-11-18 Thread Damian Conway
Ken Fox lamented: Or the circumfix ... operator. Which is the problem here. This is like playing poker with God. I hear God prefers dice. What does the circumfix ... operator do? It's the ASCII synonym for the «...» operator, which is a synonym for the qw/.../ operator. Here docs are

Re: Continuations

2002-11-18 Thread Ken Fox
Damian Conway wrote: It's [...] the ASCII synonym for the «...» operator, which is a synonym for the qw/.../ operator. Nope. Heredocs still start with . Hey! Where'd *that* card come from? ;) Seriously, that's a good trick. How does it work? What do these examples do? print a b c;

Re: Continuations

2002-11-18 Thread Damian Conway
Seriously, that's a good trick. How does it work? What do these examples do? print a b c; Squawks about finding the string b immediately after the heredoc introducer. print a b c; Likewise. Is it illegal now to use quotes in qw()? Nope. Only as the very first

Re: Continuations elified

2002-11-18 Thread David Wheeler
On Monday, November 18, 2002, at 06:51 PM, Damian Conway wrote: for $fh {...}# Build and then iterate a lazy array (the elements # of which call back to the filehandle's input # retrieval coroutine) for $iter {...} # Build and then iterate a lazy array (the elements #

Re: Continuations elified

2002-11-18 Thread Luke Palmer
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm X-Sent: 19 Nov 2002 02:51:54 GMT Date: Tue, 19 Nov 2002 13:51:56 +1100 From: Damian Conway [EMAIL PROTECTED] X-Accept-Language: en, en-us Cc: [EMAIL PROTECTED] [EMAIL PROTECTED] X-SMTPD: qpsmtpd/0.12, http://develooper.com/code/qpsmtpd/

Re: Continuations elified

2002-11-18 Thread Damian Conway
David Wheeler asked: How will while behave? Cwhile evaluates its first argument in scalar context, so: while $fh {...}# Iterate until $fh.readline returns EOF? More or less. Technically: call $fh.next and execute the loop body if that method returns true. Whether it still has the

Re: Continuations elified

2002-11-18 Thread David Wheeler
On Monday, November 18, 2002, at 08:05 PM, Damian Conway wrote: while $fh {...}# Iterate until $fh.readline returns EOF? More or less. Technically: call $fh.next and execute the loop body if that method returns true. Whether it still has the automatic binding to $_ and the implicit

Re: Continuations

2002-11-18 Thread Luke Palmer
Date: Tue, 19 Nov 2002 14:29:46 +1100 From: Damian Conway [EMAIL PROTECTED] Ken Fox lamented: Or the circumfix ... operator. Which is the problem here. This is like playing poker with God. I hear God prefers dice. What does the circumfix ... operator do? It's the ASCII

Re: Continuations elified

2002-11-18 Thread Damian Conway
David Wheeler asked: while $fh {...}# Iterate until $fh.readline returns EOF? That's a scalar context? Sure. Cwhile always evaluates its condition in a scalar context. Damian

Re: Continuations

2002-11-18 Thread Damian Conway
Luke Palmer asked: What was the final syntax for vector ops? @a ≪+≫ @b @a ≫+≪ @b The latter (this week, at least ;-). Damian

Re: Continuations

2002-11-18 Thread Iain 'Spoon' Truskett
* Damian Conway ([EMAIL PROTECTED]) [19 Nov 2002 15:19]: Luke Palmer asked: What was the final syntax for vector ops? @a ???+??? @b @a ???+??? @b The latter (this week, at least ;-). Y'know, for those of us who still haven't set up Unicode, they look remarkably similar =)

Re: Continuations elified

2002-11-18 Thread David Wheeler
On Monday, November 18, 2002, at 08:17 PM, Damian Conway wrote: Sure. Cwhile always evaluates its condition in a scalar context. Oh, duh. Thanks. David -- David Wheeler AIM: dwTheory [EMAIL PROTECTED] ICQ: 15726394

Re: Continuations

2002-11-18 Thread Damian Conway
Iain 'Spoon' Truskett wrote: @a ???+??? @b @a ???+??? @b Y'know, for those of us who still haven't set up Unicode, they look remarkably similar =) Think Of It As Evolution In Action ;-) Damian

Re: Continuations

2002-11-18 Thread David Wheeler
On Monday, November 18, 2002, at 08:19 PM, Damian Conway wrote: (B (B What was the final syntax for vector ops? (B @a $B"c(B+$B"d(B @b (B @a $B"d(B+$B"c(B @b (B (B The latter (this week, at least ;-). (B (BThis reminds me: I though of another set of bracing characters that

RE: Continuations

2002-11-17 Thread Angel Faus
Damian Conway wrote: The formulation of coroutines I favour doesn't work like that. Every time you call a suspended coroutine it resumes from immediately after the previous Cyield than suspended it. *And* that Cyield returns the new argument list with which it was resumed. So you can write

Re: Continuations

2002-11-17 Thread Dan Sugalski
At 1:29 PM +1100 11/17/02, Damian Conway wrote: The formulation of coroutines I favour doesn't work like that. Every time you call a suspended coroutine it resumes from immediately after the previous Cyield than suspended it. *And* that Cyield returns the new argument list with which it was

Re: Continuations

2002-11-17 Thread Damian Conway
Angel Faus wrote: I understand that this formulation is more powefull, but one thing I like about python's way (where a coroutine is just a funny way to generate lazy arrays) is that it lets you _use_ coroutines without even knowing what they are about. Such as when you say: for $graph.nodes {

Re: Continuations

2002-11-17 Thread Damian Conway
Of course, apart from the call-with-new-args behaviour, having Pythonic coroutines isn't noticably less powerful. Given: sub fibs ($a = 0 is copy, $b = 1 is copy) { loop { yield $b; ($a, $b) = ($b, $a+b); } } we still have implicit iteration:

Re: Continuations

2002-11-17 Thread Luke Palmer
Date: Mon, 18 Nov 2002 09:28:59 +1100 From: Damian Conway [EMAIL PROTECTED] I've a couple of questions here: we still have implicit iteration: for fibs() { print Now $_ rabbits\n; } Really? What if fibs() is a coroutine that returns lists (Fibonacci lists, no less),

Re: Continuations

2002-11-17 Thread Damian Conway
Luke Palmer enquired: we still have implicit iteration: for fibs() { print Now $_ rabbits\n; } Really? What if fibs() is a coroutine that returns lists (Fibonacci lists, no less), and you just want to iterate over one of them? The syntax: for fibs { print Now

Re: Continuations

2002-11-16 Thread Damian Conway
Peter Haworth asked: So to get the same yield context, each call to the coroutine has to be from the same calling frame. If you want to get several values from the same coroutine, but from different calling contexts, can you avoid the need to wrap it in a closure? I don't think so. Damian

Re: Continuations

2002-11-16 Thread Dan Sugalski
At 8:31 AM +1100 11/17/02, Damian Conway wrote: Peter Haworth asked: So to get the same yield context, each call to the coroutine has to be from the same calling frame. If you want to get several values from the same coroutine, but from different calling contexts, can you avoid the need to wrap

Re: Continuations

2002-11-16 Thread Damian Conway
Dan Sugalski wrote: I dunno. One of the things I've seen with coroutines is that as long as you call them with no arguments, you get another iteration of the coroutine--you actually had to call it with new arguments to reset the thing. The formulation of coroutines I favour doesn't work

Re: Continuations

2002-11-12 Thread Peter Haworth
On Wed, 06 Nov 2002 10:38:45 +1100, Damian Conway wrote: Luke Palmer wrote: I just need a little clarification about yield(). Cyield is exactly like a Creturn, except that when you call the subroutine next time, it resumes from after the Cyield. how do you tell the difference between a

Continuations

2002-11-05 Thread Luke Palmer
I just need a little clarification about yield(). consider this sub: sub iterate(foo) { yield for foo; undef; } (Where yield defaults to the topic) Presumably. a = (1, 2, 3, 4, 5); while($_ = iterate a) { print } Will print 12345. Or is that:

Re: Continuations for fun and profit

2002-07-09 Thread Ted Zlatanov
On Mon, 8 Jul 2002, [EMAIL PROTECTED] wrote: Yep. But serializing continuations is either tough, or not completely doable, since programs tend to have handles on things outside their direct control like filehandles, sockets, database connections, and suchlike things. Resuming a continuation

Re: Continuations for fun and profit

2002-07-09 Thread Peter Haworth
On Mon, 8 Jul 2002 16:54:16 -0400, Dan Sugalski wrote: while ($foo) { $foo--; } Pretty simple. (For illustrative purposes) To do that with continuations, it'd look like: $cont = take_continuation(); if ($foo) { $foo--; invoke($cont); } When

Re: Continuations for fun and profit

2002-07-09 Thread Peter Haworth
On Tue, 9 Jul 2002 16:42:03 +0100, Peter Haworth wrote: When you invoke a continuation you put the call scratchpads and lexical scratchpads back to the state they were when you took the continuation. If you restore the lexicals, how does this ever finish? Never mind. It's the *access* to

The Past, Present and Future of Continuations (was: Perl 6 Summary)

2002-07-08 Thread Andy Wardley
A short time ago, in a nearby thread, Larry Wall wrote: Perhaps we should just explain continuations in terms of time travel. Funny. I wrote a message to this effect the other night, but decided not to send it (too tired to decide if I was talking sense or nonsense). I was about to propose

Continuations for fun and profit

2002-07-08 Thread Dan Sugalski
both the variables and call scratchpads, making it, in effect, as if we'd never really left the spot we took the continuation at. And, like normal closures, we can do this from wherever we like in the program. The nice thing about continuations is you can do all the known control-flow operations

Re: The Past, Present and Future of Continuations (was: Perl 6Summary)

2002-07-08 Thread Dan Sugalski
At 2:43 PM +0100 7/8/02, Andy Wardley wrote: A short time ago, in a nearby thread, Larry Wall wrote: Perhaps we should just explain continuations in terms of time travel. Funny. I wrote a message to this effect the other night, but decided not to send it (too tired to decide if I was talking

Re: Continuations for fun and profit

2002-07-08 Thread David M. Lloyd
On Mon, 8 Jul 2002, Dan Sugalski wrote: Pretty simple. (For illustrative purposes) To do that with continuations, it'd look like: $cont = take_continuation(); if ($foo) { $foo--; invoke($cont); } take_continuation() returns a continuation for the current point

  1   2   >