Em Ter, 2009-05-26 às 19:33 -0700, Jon Lang escreveu:
The exact semantics of autothreading with respect to control
structures are subject 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.
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
Sounds like threads to me.
What I see that's different from common threads in other languages is
that they are all the same, rather than one master and many new threads
that have no context history above them. In Perl 6, every thread sees
the same dynamic scope as the original. It doesn't
Jon Lang dataweaver-at-gmail.com |Perl 6| wrote:
From S09, under Junctions:
The exact semantics of autothreading with respect to control
structures are subject to change over time; it is therefore erroneous
to pass junctions to any control construct that is not implemented via
as a normal
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
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
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
Austin Hastings wrote:
for each $dance: {
^ note colon
1- Why is the colon there? Is this some sub-tile syntactical new-ance
that I missed in a prior message, or a new thing?
It's the way we mark an indirect object in Perl 6.
2- Why is the colon necessary? Isn't the
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
--- 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
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
Larry wrote:
So you can do it any of these ways:
for $dance {
for $dance.each {
for each $dance: {
^ note colon
1- Why is the colon there? Is this some sub-tile syntactical new-ance
that I missed in a prior message, or a new thing?
2- Why is the colon
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
--- 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
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.
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
--- 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
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
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
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
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
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;
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
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
#
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/
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
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
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
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
Luke Palmer asked:
What was the final syntax for vector ops?
@a ≪+≫ @b
@a ≫+≪ @b
The latter (this week, at least ;-).
Damian
* 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 =)
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
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
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
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
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
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 {
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:
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),
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
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
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
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
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
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
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
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
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
On Mon, Jul 08, 2002 at 04:54:16PM -0400, 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
At 04:54 PM 7/8/02 -0400, Dan Sugalski wrote:
A continuation is a sort of super-closure. Like a closure it captures
its lexical variables, so every time you use it, you're referring to
the same set of variables, which live on until the continuation's
destroyed. This works because the variables
At 3:01 PM -0700 7/8/02, Peter Scott wrote:
At 04:54 PM 7/8/02 -0400, Dan Sugalski wrote:
A continuation is a sort of super-closure. Like a closure it
captures its lexical variables, so every time you use it, you're
referring to the same set of variables, which live on until the
continuation's
At 10:24 PM +0100 7/8/02, Nicholas Clark wrote:
On Mon, Jul 08, 2002 at 04:54:16PM -0400, 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);
Thus it was written in the epistle of Peter Scott,
So if you could serialize a continuation, you could freeze your program
state to disk and restore it later? Cool, makes for easy checkpoint/restarts.
I think that that would be true only if *all* data was maintained in those
scratchpads
53 matches
Mail list logo