Coroutines in Perl 6 (Was: Re: Converting a Perl 5 "pseudo-continuation" to Perl 6)

2009-01-02 Thread Daniel Ruoso
Em Qui, 2009-01-01 às 12:34 -0800, Geoffrey Broadwell escreveu: > In the below Perl 5 code, I refactored to pull the two halves of the PID > file handling out of init_server(), but to do so, I had to return a sub > from pid_file_handler() that acted as a "continuation". The syntax is a > bit ugly,

Re: Coroutines in Perl 6 (Was: Re: Converting a Perl 5 "pseudo-continuation" to Perl 6)

2009-01-02 Thread Daniel Ruoso
Em Sex, 2009-01-02 às 08:34 -0300, Daniel Ruoso escreveu: > token routine_def: {...} Actually, I was just looking at STD, and the correct token would be token routine_declarator:coro { } I was also looking at the spec files, and I realized that DRAFT S17 mentions coroutines, but its defini

Re: Converting a Perl 5 "pseudo-continuation" to Perl 6

2009-01-02 Thread Leon Timmermans
When going OO, I'd say an augment()/inner() approach would be cleanest. See http://search.cpan.org/~drolsky/Moose/lib/Moose/Cookbook/Basics/Recipe6.pod for an example. I don't know how to express that in Perl 6 though. Regards, Leon On Fri, Jan 2, 2009 at 2:08 AM, Steve Lukas wrote: > Hello, >

r24732 - docs/Perl6/Spec

2009-01-02 Thread pugs-commits
Author: particle Date: 2009-01-02 14:36:54 +0100 (Fri, 02 Jan 2009) New Revision: 24732 Modified: docs/Perl6/Spec/S06-routines.pod docs/Perl6/Spec/S19-commandline.pod Log: [spec] get rid of ugly and confusing C<+option> syntax (bad unix memes)-- Modified: docs/Perl6/Spec/S06-routines.pod ==

Re: r24711 - docs/Perl6/Spec

2009-01-02 Thread jerry gay
On Thu, Jan 1, 2009 at 03:30, Darren Duncan wrote: > pugs-comm...@feather.perl6.nl wrote: >> >> --name :name >> --name=value:name >> --name="spacy value":name«'spacy value'» >> --name='spacy value':name«'spacy value'» >> --na

r24734 - docs/Perl6/Spec

2009-01-02 Thread pugs-commits
Author: particle Date: 2009-01-02 15:15:35 +0100 (Fri, 02 Jan 2009) New Revision: 24734 Modified: docs/Perl6/Spec/S06-routines.pod docs/Perl6/Spec/S19-commandline.pod Log: [spec] options must appear before script name; update version/date metadata Modified: docs/Perl6/Spec/S06-routines.pod

r24735 - docs/Perl6/Spec

2009-01-02 Thread pugs-commits
Author: particle Date: 2009-01-02 16:42:53 +0100 (Fri, 02 Jan 2009) New Revision: 24735 Modified: docs/Perl6/Spec/S19-commandline.pod Log: [S19] explain how script passed on command-line or via STDIN works Modified: docs/Perl6/Spec/S19-commandline.pod ==

Re: Converting a Perl 5 "pseudo-continuation" to Perl 6

2009-01-02 Thread Geoffrey Broadwell
On Fri, 2009-01-02 at 14:19 +0200, Leon Timmermans wrote: > When going OO, I'd say an augment()/inner() approach would be > cleanest. See > http://search.cpan.org/~drolsky/Moose/lib/Moose/Cookbook/Basics/Recipe6.pod > for an example. I don't know how to express that in Perl 6 though. There's no d

r24737 - docs/Perl6/Spec

2009-01-02 Thread pugs-commits
Author: particle Date: 2009-01-02 17:08:51 +0100 (Fri, 02 Jan 2009) New Revision: 24737 Modified: docs/Perl6/Spec/S19-commandline.pod Log: [spec] add signature for perl6, and make --output-format entirely implementation-specific Modified: docs/Perl6/Spec/S19-commandline.pod ==

r24738 - docs/Perl6/Spec

2009-01-02 Thread pugs-commits
Author: particle Date: 2009-01-02 17:17:06 +0100 (Fri, 02 Jan 2009) New Revision: 24738 Modified: docs/Perl6/Spec/S19-commandline.pod Log: [spec] add note about dangers of mixing -e and -e6 Modified: docs/Perl6/Spec/S19-commandline.pod ==

Re: r24737 - docs/Perl6/Spec

2009-01-02 Thread Geoffrey Broadwell
On Fri, 2009-01-02 at 17:08 +0100, pugs-comm...@feather.perl6.nl wrote: > +=head2 Synopsis > + > + multi sub perl6( > +Bool :a($autosplit), > +Bool :c($check-syntax), > +Bool :$doc, > +:e($execute), > +:$execute-lax, #TODO fix illegal -e6 syntax. -6? not legal. -x? hrmm > +

r24739 - docs/Perl6/Spec

2009-01-02 Thread pugs-commits
Author: particle Date: 2009-01-02 19:31:51 +0100 (Fri, 02 Jan 2009) New Revision: 24739 Modified: docs/Perl6/Spec/S19-commandline.pod Log: [spec] C<-e6> isn't a separate item, it's a idiom meaning -e '6;'; format perl6 signature, (geoff broadwell)++ Modified: docs/Perl6/Spec/S19-commandline.p

Re: r24737 - docs/Perl6/Spec

2009-01-02 Thread jerry gay
On Fri, Jan 2, 2009 at 09:27, Geoffrey Broadwell wrote: > On Fri, 2009-01-02 at 17:08 +0100, pugs-comm...@feather.perl6.nl wrote: >> +=head2 Synopsis >> + >> + multi sub perl6( >> +Bool :a($autosplit), >> +Bool :c($check-syntax), >> +Bool :$doc, >> +:e($execute), >> +:$execute

Re: r24737 - docs/Perl6/Spec

2009-01-02 Thread Geoffrey Broadwell
Thank you for the quick turnaround! On Fri, 2009-01-02 at 10:55 -0800, jerry gay wrote: > On Fri, Jan 2, 2009 at 09:27, Geoffrey Broadwell wrote: > > It's also not > > obvious what a boolean named $doc does -- which probably means either > > that it's not supposed to be a boolean, or it needs a s

Re: r24737 - docs/Perl6/Spec

2009-01-02 Thread jerry gay
On Fri, Jan 2, 2009 at 11:24, Geoffrey Broadwell wrote: > Thank you for the quick turnaround! > > On Fri, 2009-01-02 at 10:55 -0800, jerry gay wrote: >> On Fri, Jan 2, 2009 at 09:27, Geoffrey Broadwell wrote: >> > It's also not >> > obvious what a boolean named $doc does -- which probably means e

Re: Converting a Perl 5 "pseudo-continuation" to Perl 6

2009-01-02 Thread Aristotle Pagaltzis
* Geoffrey Broadwell [2009-01-01 21:40]: > In the below Perl 5 code, I refactored to pull the two halves of the PID > file handling out of init_server(), but to do so, I had to return a sub > from pid_file_handler() that acted as a "continuation". The syntax is a > bit ugly, though. Is there a c

[perl #61916] initialization parameters from base classes

2009-01-02 Thread Dave Whipp
# New Ticket Created by "Dave Whipp" # Please include the string: [perl #61916] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=61916 > The default "new" method allows values of attributes to be set as named args -- but raku

[perl #61918] classes don't get a default .perl method

2009-01-02 Thread Dave Whipp
# New Ticket Created by "Dave Whipp" # Please include the string: [perl #61918] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=61918 > rakudo: class A { has $.foo }; my A $a .=new( foo => 42 ); say $a.perl

[perl #61920] [PATCH] test division in 02-op-math.t

2009-01-02 Thread Kyle Hasselbacher
# New Ticket Created by "Kyle Hasselbacher" # Please include the string: [perl #61920] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=61920 > I didn't see division in with the other "basic math ops", so... Index: languages

[perl #61924] Incrementing an untyped, undefined variable makes Rakudo dump core

2009-01-02 Thread via RT
# New Ticket Created by Markus Laker # Please include the string: [perl #61924] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=61924 > Two things are unexpected here: the fact that Rakudo thinks $x is an instance of class T

[perl #61926] Can't declare the element type of an array or hash

2009-01-02 Thread via RT
# New Ticket Created by Markus Laker # Please include the string: [perl #61926] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=61926 > FWIW, the first two examples look correct to me. An undefined Int should stringify to `

[perl #61930] [PATCH] More tests in 04-op-cmp.t

2009-01-02 Thread Kyle Hasselbacher
# New Ticket Created by "Kyle Hasselbacher" # Please include the string: [perl #61930] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=61930 > I don't know why '1 < 2' would work but '2 < 1' would not work, but this tests fo

Re: [perl #61904] [BUG] r34778 - code takes forever

2009-01-02 Thread Mark A. Hershberger
Sorry for not finding the specific problem before. > while($not_prime && $!number++) { > $not_prime = @!primes.grep({$!number % $^a == 0}); > } The problem with Rakudo is that it is setting @!primes to a list containing a single item (the latest value of $!number) on each turn throu

[perl #61914] [BUG] Declarator Parser Failure if Whitespace after Opening Paren

2009-01-02 Thread publiustemp-perl6compil...@yahoo.com (via RT)
# New Ticket Created by publiustemp-perl6compil...@yahoo.com # Please include the string: [perl #61914] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=61914 > This works fine: class Foo { has ($.this, $.t

[Parrot] New comment on Solutions to the Exercises in Episode 4.

2009-01-02 Thread Rolf
Rolf has left a new comment on your post "Solutions to the Exercises in Episode 4": The global $?BLOCK variable you're using in the exception rule is only introduced in Episode 5 of this tutorial. As a result, your solution to implementing the try statement can't be easily applied to the code I ha

Re: [perl #61904] [BUG] r34778 - code takes forever

2009-01-02 Thread Andy_Bach
class Prime { has @!primes is rw; has Int $!number is rw = 1; method next() { my $not_prime = 1; while($not_prime && $!number++) { $not_prime = @!primes.grep({$!number % $^a == 0}); } Appears that last assignment changes $not_prime.WHAT from "Int" into "Array". a ---

[perl #61928] [BUG] (undef === undef)

2009-01-02 Thread via RT
# New Ticket Created by Todd Hepler # Please include the string: [perl #61928] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=61928 > Hi. I think this is a bug, but I'm not sure. (undef === undef) currently evaluates to f

Re: Converting a Perl 5 "pseudo-continuation" to Perl 6

2009-01-02 Thread Geoffrey Broadwell
On Fri, 2009-01-02 at 22:56 +0100, Aristotle Pagaltzis wrote: > > When I asked this question on #perl6, pmurias suggested using > > gather/take syntax, but that didn't feel right to me either -- > > it's contrived in a similar way to using a one-off closure. > > Contrived how? Meaning, the gather

Re: r24737 - docs/Perl6/Spec

2009-01-02 Thread Geoffrey Broadwell
On Fri, 2009-01-02 at 12:27 -0800, jerry gay wrote: > oh, yes, whoops! i responded to someone else in #pugs earlier, and > forgot to address the item here. C replaces p5's > C (that's the latest idea from damian, although it seems not > to be published yet). Ah, I get it! What about perldoc's spe

Re: Converting a Perl 5 "pseudo-continuation" to Perl 6

2009-01-02 Thread Mark J. Reed
On Fri, Jan 2, 2009 at 9:06 PM, Geoffrey Broadwell wrote: > It does bring up a question, though. What if pid_file_handler() needed > to be broken into three or more pieces, thus containing multiple yield > statements? Does only the first one return a continuation object, which > can be called re

Re: r24737 - docs/Perl6/Spec

2009-01-02 Thread jason switzer
On Fri, Jan 2, 2009 at 8:12 PM, Geoffrey Broadwell wrote: > On Fri, 2009-01-02 at 12:27 -0800, jerry gay wrote: > > oh, yes, whoops! i responded to someone else in #pugs earlier, and > > forgot to address the item here. C replaces p5's > > C (that's the latest idea from damian, although it seems n

Re: Converting a Perl 5 "pseudo-continuation" to Perl 6

2009-01-02 Thread Larry Wall
On Fri, Jan 02, 2009 at 06:06:31PM -0800, Geoffrey Broadwell wrote: : Meaning, the gather/take syntax doesn't make much sense, because we're : not "gathering" anything; the PID file handler has nothing to return. : We'd only be using it for the "side effect" of being able to pause the : callee's ex