Re: Scripting competition: password solution
wrong pod commands s/=pod/=begin/ s/=cut/=end/ Richard Hainsworth wrote: Here's a solution to the scripting competition test. Patrick suggested publishing solutions somewhere, including this list. #!/usr/local/bin/perl6 =pod Patrick Michaud suggested (http://use.perl.org/~pmichaud/journal/38134?from=rss) writing solutions to scripting game definitions as a way of experimenting with perl6. This program is a suggested solution to event 5, strong passwords, in the scripting games. The scenario is described at http://www.microsoft.com/technet/scriptcenter/funzone/games/games08/aevent5.mspx So here is my first attempt. I have kept to the definition in the competition, even though this means hard coding the top score (13) and evaluation points (11,7). Although I suppose part of the competition is to get funcky ways of solving the problem, I just used a straightforward implimentation of the tests. They are so easy in perl6! The only real problem is to associate a test with the string to be printed when a test fails. =cut use v6; my $pw = @*ARGS[0]; my @msg; # Here we have an array of rules that if matched yield a test failure as per the game, and the error string to go with it. my @rules = ( [{!(10 < .chars < 20)},'Length is under 10 or over 20 characters'], # Note the .chars! This will be called as the argument of a when clause and so $_ will contain the value of $pw. [ / ^ <-digit>+ $ / , 'Does not contain a digit'], =pod I think this is so neat! It took a while and an email from Patrick to find. is supplied by PGE (perl6 grammar engine). So by definition, <-digit> is not a digit. A string that does not contain a digit will consist entirely of non-digits. Hence by "stretching" the match pattern from the start ^ of the string to the end of the string $ with a pattern containing as many chars as necessary +, we match a string without a single digit. =cut [ / ^ <-upper>+ $ / , 'Does not contain an upper case letter'], [ / ^ <-lower>+ $ / , 'Does not contain an lower case letter'], [ / ^ + $ / , 'Does not contain a symbol character'], [ / **4 / , 'Four or more lower case characters in succession'], [ / **4 / , 'Four or more upper case characters in succession'], [ / (.) [.+] $0 / , 'A duplicate character with same case is used'] ); =pod Developing and testing a pattern that yielded a duplicate character ignoring case was so easy it took two minutes to work out and test. In order to see how a pattern would work out, I compiled perl6 to an executable and put a link to it in /usr/local/bin then perl6 on the command line in a console and something like >my $x='abcedeA';$x~~m//??say 'M' !! say 'NM' M The > is the prompt from perl6. The M is the response. What's nice is that a simple cursor-up brings back the previous line for experimenting. see below for why the next section is commented out =cut #my @rules4list = ( #['', m/ (:i $pw) /,'Matches a real word'], #['s/^ . (.*) $ / $0 /', / (:i $pw) /, 'Matches a real word without the first character'], #['s/^ (.*) . $/ $0 /', / (:i $pw) /,'Matches a real word without the last character'], #['tr/O/0/', / (:i $pw) /, 'Matches a real word with digit 0 in place of letter O'], #['tr/l/1/', / (:i $pw) /, 'Matches a real word with digit 1 in place of letter l'] #); #my $orig; if $pw { # trap zero-length passwords =pod This commented out section does not work because three things do not appear to have been implimented: a) m/$pw/ matching a scalar. According to S05 the should be passed raw to the matching engine and treated as a string if it does not contain a rule b) s/// c) tr/// It might not work even so due to some error I've missed. =cut #my $words = open('wordlist.txt', :r) or die $!; #for =$words { #for @rules4list -> @r { #$orig = $_; #eval(@r[0]); #when @r[1] { push @msg, @r[2] } #}; #}; given $pw { for @rules -> @r { when @r[0] { push @msg, @r[1] } } }; =pod Isnt perl6 compact? Five lines to run all the tests against $pw and capture any error messages 'given' moves the password automatically to $_ 'for' takes each of the array and puts it into @r, in this case another array because @rules is an array of arrays 'when' applies the test statement to $_, and if a boolean true is the result, the next block pushes the message onto the array Note that one of the tests was a bare block, which is treated as code, while the others were bare regexen. when does the rest Since an error message is pushed onto the array for each failure condition, the size of the array gives the score. =cut say 'A password score of ' ~ 13 - @msg.elems ~ ' indicates a ' ~ (given 13 - @msg.elems { when $_ > 10 { 'strong'} when $_ > 7 { 'moderately strong'} default { 'weak' } }) ~ ' password'; =pod Here I used the fact that the value of a 'given' block is the value of the last block. Since
Re: r24809 - docs/Perl6/Spec
pugs-comm...@feather.perl6.nl writes: > +=item -x > + > +Run program embedded in ASCII text. Infrequently used, and doesn't > +deserve its own command-line option. I understand the use case for that option is piping a mail or news message to `perl -x` to run a script contained within it. If that use case is to be handled, it pretty much does need to be able to be triggered from the command line, even if not with a single-char option. I'd be in favour of either explaining why this ability is not considered valuable (if that is indeed the case), or (preferably) restoring a simple command-line-accessible way of achieving the same thing. -- Aaron Crane ** http://aaroncrane.co.uk/
[perl #62112] sort hash by value
# New Ticket Created by Richard Hainsworth # Please include the string: [perl #62112] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=62112 > Using the idiom in http://www.rakudo.org/2008/12/its-sort-of-like.html causes a segmentation error. The following gets a hash of skaters with the averages. Next is to sort hash by average, and print top three #!/usr/local/bin/perl6 # Solution to Advanced Event 2, 2008 scripting games, http://www.microsoft.com/technet/scriptcenter/funzone/games/games08/aevent2.mspx use v6; my %aves; my @list; my $scores = open('./skaters.txt', :r) or die $!; for =$scores { @list = split /\,/,$_; @list[1..7].sort; %av...@list[0]} = ([+] @list[2..6]) / 5; }; .say for %aves; .say for %aves.sort: {.value}; skaters.pl Description: Perl program Janko Cajhen,84,80,61,81,71,62,76 Ryan Calafato,59,93,93,80,67,73,95 Iulian Calinov,56,70,76,93,79,83,58 Geert Camelbeke,97,61,55,73,70,92,63 David Campbell,87,66,62,73,76,91,91 John III Campbell,93,51,61,55,84,99,91 Chris Cannon,60,79,73,63,51,60,61 Jon Cantrell,59,64,99,66,73,52,65 Jun Cao,64,80,83,65,57,82,97 Anthony Cappiello-Guy,89,74,56,58,51,79,84 Cyril Carbonati,97,57,77,90,78,64,58 Richard Carey,80,78,55,88,54,91,95 Jason Carlson,93,68,79,73,91,88,60 Ty Carlson,60,84,77,73,84,50,65 Fernando Caro,58,97,56,79,74,52,53 Rob Caron,85,54,51,59,99,80,89 Andy Carothers,89,88,93,64,95,51,81 Chase Carpenter,94,93,58,92,94,86,60 Matthew Carroll,75,67,52,85,60,80,57 Adam Carter,62,75,72,55,86,60,60 Carlos Carvallo,87,95,56,84,52,83,79 Rob Cason,97,71,97,57,51,69,83 Gitte Casparij,54,89,99,55,51,62,79 Joao Casqueiro,93,50,75,84,57,52,80 Giorgio Cavaglieri,82,63,61,80,88,78,58 Matt Cavallari,53,54,52,57,66,73,80 Luisa Cazzaniga,96,71,71,87,77,59,50 Andrew Cencini,75,52,83,80,63,51,96 Baris Cetinok,86,77,91,50,84,84,71 Sean Chai,71,64,73,85,62,81,61 Gareth Chan,84,51,87,75,72,66,84 Greg Chapman,81,53,88,78,83,80,91 Mathew Charles,57,58,79,80,89,86,67 Sootha Charncherngkha,96,60,92,98,66,66,56 Neil Charney,87,82,83,81,86,71,64 Mohammad Chami,95,74,99,86,51,54,57 Ankur Chavda,99,53,81,60,96,92,80 Francisco Chaves,99,91,55,68,79,62,61 Hao Chen,99,86,62,84,63,77,59 Jacky Chen,76,62,66,92,80,50,95 John Y. Chen,62,59,82,52,76,82,57 Yao-Qiang Cheng,69,72,87,57,58,67,77 Jeff Chia,72,74,89,56,76,95,89 Lee Theng Chia,79,59,60,60,59,64,99 Martin Chisholm,93,91,79,92,64,80,83 Michal Chmiela,86,78,51,66,89,74,56 Manish Chopra,58,78,55,60,73,84,77 Ray Chow,90,78,64,91,62,61,88 Terri Chudzik,88,54,91,95,69,95,55 Bjarke Rust Christensen,99,91,88,59,81,54,97 Nicholas Christopoulos,93,54,50,64,85,73,83 Ranjit Varkey Chudukatil,55,50,79,80,85,54,59 Guido Chuffart,67,57,88,97,97,96,93 Petra Chvojková,64,71,78,57,70,69,85 Alice Ciccu,88,64,56,80,95,88,72 Ewa Ciesielska,54,57,77,84,89,51,99 Molly Clark,82,95,69,69,69,77,90 Leah Clelland,66,85,65,89,55,81,55 Christian Cletus,84,78,96,80,51,86,96 Mark-Stuart Cochrane,51,98,59,99,63,70,72 Pat Coleman,81,53,99,77,58,90,96 Jean-Charles Colon,64,72,62,93,88,89,87 Craig M. Combel,92,77,57,64,80,55,55 Aaron Con,70,61,63,98,72,99,79 Steve Conn,77,59,99,68,83,74,87 Peter Connelly,97,81,80,68,68,95,82 Cathan Cook,95,71,90,70,94,60,72 Kevin Cook,60,58,52,94,91,62,97 Patrick M. Cook,57,63,59,70,87,54,75 Jeroen Cool,77,86,58,91,68,84,65 Kenneth Cools,71,90,71,60,91,87,87 Jim Corbin,86,91,76,99,55,85,60 Michel Cordani,97,62,65,68,60,85,62 Cecilia Cornejo,65,94,96,85,54,96,87 Eva Corets,99,59,86,85,73,59,86 Ryan Cornelsen,57,69,83,65,82,92,96 Robin Counts,71,59,56,50,68,66,67 Brian Cox,89,62,67,64,75,78,93 Oliver Cox,63,64,97,56,51,80,95 Ovidiu V. Cr?ciun,63,82,50,96,85,83,92 Jack Creasey,92,91,96,81,74,81,84 Armin Cremerius-Günther,96,96,60,64,67,59,83 Ioan Crisiarcu,98,70,54,88,90,59,87 María Jesús Cuesta,92,54,64,85,98,59,96 Grant Culbertson,72,94,92,69,51,68,54 Scott Culp,58,76,51,62,56,74,71 Gonçalo Cunha,93,64,88,80,99,61,77 Conor Cunningham,92,62,50,59,82,56,85 Shiraz Cupala,87,68,88,93,50,91,71 Douglas Curran,80,80,51,56,79,86,93 Pawel Czernek,72,84,84,99,70,72,64 Wojciech Czupta,89,53,96,81,63,65,85
[perl #62116] no interpolation into string of array element
# New Ticket Created by Richard Hainsworth # Please include the string: [perl #62116] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=62116 > Array element does not interpolate it does in perl5 (Is this a design choice or a rakudo bug?) $ perl6 > my @x=(1,2,3); say "2nd is @x[1]" 2nd is @x[1] $ zoid --[ This is the Zoidberg shell ]--[ Version 0.96 ]-- ### This is a development version, consider it unstable $ @x=(1,2,3);print "2nd is $x[1]\n"; 2nd is 2 Array element interpolation is not listed as something common not working in Rakudo.
[perl #62122] ~ in regexes doesn't allow braces as the last term
# New Ticket Created by Moritz Lenz # Please include the string: [perl #62122] # in the subject line of all future correspondence about this issue. # http://rt.perl.org/rt3/Ticket/Display.html?id=62122 > 11:33 < p6eval> rakudo 35266: OUTPUT«(aa)» 11:35 <@moritz_> rakudo: regex recursive { '(' ~ ')' ['a'*] }; say '(aa)' ~~ m// 11:35 < p6eval> rakudo 35266: OUTPUT«Syntax error at line 1, near "}; say '(a"current instr.: 'parrot;PGE;Util;die' pc 129 (runtime/parrot/library/PGE/Util.pir:83)» '(' ~ ')' 'a'* parses and does what I mean, but when I replace the last term with ['a'*] it fails to parse. Cheers, Moritz -- Moritz Lenz http://perlgeek.de/ | http://perl-6.de/ | http://sudokugarden.de/
Re: [perl #62116] no interpolation into string of array element
On Fri, Jan 9, 2009 at 02:31, via RT Richard Hainsworth wrote: > # New Ticket Created by Richard Hainsworth > # Please include the string: [perl #62116] > # in the subject line of all future correspondence about this issue. > # http://rt.perl.org/rt3/Ticket/Display.html?id=62116 > > > > Array element does not interpolate it does in perl5 > (Is this a design choice or a rakudo bug?) > > $ perl6 > > my @x=(1,2,3); say "2nd is @x[1]" > 2nd is @x[1] > > $ zoid > --[ This is the Zoidberg shell ]--[ Version 0.96 ]-- > ### This is a development version, consider it unstable > $ @x=(1,2,3);print "2nd is $x[1]\n"; > 2nd is 2 > > Array element interpolation is not listed as something common not > working in Rakudo. > this is a design choice. in order to interpolate this, use a closure inside the string. my @x = 1, 2, 3; say "2nd is {...@x[1]}"; # 2nd is 2 ~jerry
Re: [perl #62116] no interpolation into string of array element
On Fri, Jan 9, 2009 at 08:26, Jonathan Scott Duff wrote: > On Fri, Jan 9, 2009 at 9:49 AM, jerry gay wrote: >> >> On Fri, Jan 9, 2009 at 02:31, via RT Richard Hainsworth >> wrote: >> > # New Ticket Created by Richard Hainsworth >> > # Please include the string: [perl #62116] >> > # in the subject line of all future correspondence about this issue. >> > # http://rt.perl.org/rt3/Ticket/Display.html?id=62116 > >> > >> > >> > Array element does not interpolate it does in perl5 >> > (Is this a design choice or a rakudo bug?) >> > >> > $ perl6 >> > > my @x=(1,2,3); say "2nd is @x[1]" >> > 2nd is @x[1] >> > >> > $ zoid >> > --[ This is the Zoidberg shell ]--[ Version 0.96 ]-- >> > ### This is a development version, consider it unstable >> > $ @x=(1,2,3);print "2nd is $x[1]\n"; >> > 2nd is 2 >> > >> > Array element interpolation is not listed as something common not >> > working in Rakudo. >> > >> this is a design choice. in order to interpolate this, use a closure >> inside the string. >> my @x = 1, 2, 3; say "2nd is {...@x[1]}"; # 2nd is 2 > > Er ... that may be a temporary rakudo design choice, but S02 says: > > Bare scalar variables always interpolate in double-quotish > > > strings. Bare array, hash, and subroutine variables may I be > interpolated. However, any scalar, array, hash or subroutine variable may > > > start an interpolation if it is followed by a sequence of one or more > bracketed > > dereferencers: that is, any of: > > =over 4 > > =item 1. An array subscript > > =item 2. A hash subscript > > =item 3. A set of parentheses indicating a function call > > =item 4. Any of 1 through 3 in their B form > > > > =item 5. A method call that includes argument parentheses > > =item 6. A sequence of one or more unparenthesized method call, followed by > any of 1 through 5 > > =back > > In other words, this is legal: > > "Val = $a.ord.fmt('%x')\n" > > and is equivalent to > > "Val = { $a.ord.fmt('%x') }\n" > > > So, it would seem that > > my @x = 1, 2, 3; say "2nd is @x[1]"; # 2nd is 2 > > is perfectly valid perl 6. > ah! thank you for correcting me, i misremembered. "@x" won't interpolate in perl 6. "@x[1]" will, but is currently not implemented in rakudo. for the meantime, the workaround is to use closure form: "{...@x[1]}". ~jerry
Re: [perl #62116] no interpolation into string of array element
jerry (>), Richard (>>): >> Array element interpolation is not listed as something common not >> working in Rakudo. >> > this is a design choice. ...Meaning that it has dependencies to other components in Rakudo being replaced or improved, not that it won't ever be implemented in Rakudo. :) // Carl
Re: [perl #62116] no interpolation into string of array element
On Fri, Jan 9, 2009 at 9:49 AM, jerry gay wrote: > On Fri, Jan 9, 2009 at 02:31, via RT Richard Hainsworth > wrote: > > # New Ticket Created by Richard Hainsworth > > # Please include the string: [perl #62116] > > # in the subject line of all future correspondence about this issue. > > # http://rt.perl.org/rt3/Ticket/Display.html?id=62116 > > > > > > > Array element does not interpolate it does in perl5 > > (Is this a design choice or a rakudo bug?) > > > > $ perl6 > > > my @x=(1,2,3); say "2nd is @x[1]" > > 2nd is @x[1] > > > > $ zoid > > --[ This is the Zoidberg shell ]--[ Version 0.96 ]-- > > ### This is a development version, consider it unstable > > $ @x=(1,2,3);print "2nd is $x[1]\n"; > > 2nd is 2 > > > > Array element interpolation is not listed as something common not > > working in Rakudo. > > > this is a design choice. in order to interpolate this, use a closure > inside the string. > my @x = 1, 2, 3; say "2nd is {...@x[1]}"; # 2nd is 2 Er ... that may be a temporary rakudo design choice, but S02 says: Bare scalar variables always interpolate in double-quotish strings. Bare array, hash, and subroutine variables may I be interpolated. However, any scalar, array, hash or subroutine variable may start an interpolation if it is followed by a sequence of one or more bracketed dereferencers: that is, any of: =over 4 =item 1. An array subscript =item 2. A hash subscript =item 3. A set of parentheses indicating a function call =item 4. Any of 1 through 3 in their B form =item 5. A method call that includes argument parentheses =item 6. A sequence of one or more unparenthesized method call, followed by any of 1 through 5 =back In other words, this is legal: "Val = $a.ord.fmt('%x')\n" and is equivalent to "Val = { $a.ord.fmt('%x') }\n" So, it would seem that my @x = 1, 2, 3; say "2nd is @x[1]"; # 2nd is 2 is perfectly valid perl 6. -Scott -- Jonathan Scott Duff perlpi...@gmail.com
r24844 - docs/Perl6/Spec
Author: particle Date: 2009-01-09 21:57:14 +0100 (Fri, 09 Jan 2009) New Revision: 24844 Modified: docs/Perl6/Spec/S19-commandline.pod Log: [S19] a little copy-editing Modified: docs/Perl6/Spec/S19-commandline.pod === --- docs/Perl6/Spec/S19-commandline.pod 2009-01-09 19:36:48 UTC (rev 24843) +++ docs/Perl6/Spec/S19-commandline.pod 2009-01-09 20:57:14 UTC (rev 24844) @@ -80,13 +80,13 @@ =head1 Backward (In)compatibility -Muscles have a long memory. You may find yourself typing your favorite Perl 5 -options, even after Christmas has arrived. As you'll see below, common -options are provided which behave similarly. Less common options, however, -may not be available or may have changed syntax. If you provide Perl with -unrecognized command-line syntax, Perl gives you a friendly error message. -If the unrecognized syntax is a valid Perl 5 option, Perl provides helpful -suggestions to allow you to perform the same action using the current syntax. +You may find yourself typing your favorite Perl 5 options, even after +Christmas has arrived. As you'll see below, common options are provided +which behave similarly. Less common options, however, may not be available +or may have changed syntax. If you provide Perl with unrecognized command- +line syntax, Perl gives you a friendly error message. If the unrecognized +syntax is a valid Perl 5 option, Perl provides helpful suggestions to allow +you to perform the same action using the current syntax. =head2 Unchanged Syntactic Features
r24846 - docs/Perl6/Spec
Author: particle Date: 2009-01-09 22:05:46 +0100 (Fri, 09 Jan 2009) New Revision: 24846 Modified: docs/Perl6/Spec/S19-commandline.pod Log: [S19] describe how to avoid ambiguity when nesting delimited options Modified: docs/Perl6/Spec/S19-commandline.pod === --- docs/Perl6/Spec/S19-commandline.pod 2009-01-09 21:03:17 UTC (rev 24845) +++ docs/Perl6/Spec/S19-commandline.pod 2009-01-09 21:05:46 UTC (rev 24846) @@ -276,10 +276,8 @@ The opening and closing delimiters begin with two or more plus characters, for example C<++>. You'll usually use two plus characters, but more are -allowed to avoid ambiguity. +allowed to avoid ambiguity when nesting delimited options. -{{TODO put more below, or refer to somewhere with more}} - =item * Opening and closing delimited option names follow option identifier naming @@ -311,9 +309,26 @@ ++PARSER --prelude=Perl6-autoloop-no-print ++/PARSER is available inside your script as C<< %+OPTS >>, and contains -C<--prelude=Perl6-autoloop-no-print>. +C<--prelude=Perl6-autoloop-no-print>. Since eager matching is used, if you +need to pass something like: + ++foo -bar ++foo baz ++/foo ++/foo +you'll end up with + + %+OPTS = '-bar ++foo baz'; + +which is probably not what you wanted. Instead, add extra C<+> characters + + +++foo -bar ++foo baz ++/foo +++/foo + +which will give you + + %+OPTS = '-bar ++foo baz ++/foo'; + +allowing you to properly nest delimited options. + + Values are parsed with the following rules: =over 4
r24847 - docs/Perl6/Spec
Author: particle Date: 2009-01-09 22:13:19 +0100 (Fri, 09 Jan 2009) New Revision: 24847 Modified: docs/Perl6/Spec/S19-commandline.pod Log: [S19] add notes for further design review Modified: docs/Perl6/Spec/S19-commandline.pod === --- docs/Perl6/Spec/S19-commandline.pod 2009-01-09 21:05:46 UTC (rev 24846) +++ docs/Perl6/Spec/S19-commandline.pod 2009-01-09 21:13:19 UTC (rev 24847) @@ -14,8 +14,8 @@ Maintainer: Jerry Gay Date: 12 Dec 2008 - Last Modified: 8 Jan 2009 - Version: 13 + Last Modified: 9 Jan 2009 + Version: 14 This is a draft document. This document describes the command line interface. It has changed extensively from previous versions of Perl in order to increase @@ -215,7 +215,10 @@ =back +{{TODO for the removed Perl 5 options, address how the same functionality +can be expressed with the command-line syntax}} + =head1 Options and Values Command line options are parsed using the following rules: @@ -402,6 +405,9 @@ arguments passed to C, and is available at C time, so C can respond to command-line options. +{{TODO may create a ++DOC subsystem here. also, may use -d for short name, +even though it clashes with perl 5}} + =item ++DEBUGGER [*switches*, *flags*] ++/DEBUGGER Set debugging switches and flags.
r24848 - docs/Perl6/Spec
Author: particle Date: 2009-01-09 22:17:42 +0100 (Fri, 09 Jan 2009) New Revision: 24848 Modified: docs/Perl6/Spec/S19-commandline.pod Log: [S19] a note on assumptions Modified: docs/Perl6/Spec/S19-commandline.pod === --- docs/Perl6/Spec/S19-commandline.pod 2009-01-09 21:13:19 UTC (rev 24847) +++ docs/Perl6/Spec/S19-commandline.pod 2009-01-09 21:17:42 UTC (rev 24848) @@ -15,7 +15,7 @@ Maintainer: Jerry Gay Date: 12 Dec 2008 Last Modified: 9 Jan 2009 - Version: 14 + Version: 15 This is a draft document. This document describes the command line interface. It has changed extensively from previous versions of Perl in order to increase @@ -51,14 +51,14 @@ This interface to Perl 6 is special in that it occurs at the intersection of the program and the operating system's command line shell, and thus is not -accessed via a consistent syntax everywhere. Perl is born of Unix, and as such -the syntax presented in this document is expected to work in a Unix-style -shell. To explore the particularities of other operating systems, see -L (TBD). +accessed via a consistent syntax everywhere. A few assumptions are made here, +which will hopefully stand the test of time: All command-line arguments are +assumed to be in Unicode unless proven otherwise; and Perl is born of Unix, +and as such the syntax presented in this document is expected to work in a +Unix-style shell. To explore the particularities of other operating systems, +see L (TBD). -[my notes/conjectures below are all in square brackets --TimToady] - =head1 Command Line Elements The command line is broken down into two basic elements: a I, and @@ -574,15 +574,6 @@ This should try to use whatever option does the same thing to a new filehandle when S16 is further developed. -Do I need to address any unicode concerns? - -[You can try "all command line arguments are assumed to be in unicode -unless proven otherwise" and see how well it flies. :) but this starts -to get into filenames-are-blobs kind of issues...maybe we need a way -of marking arguments as needing to be encoded into a Buf. but for sanity -we must try to settle on unicode as the default expectation. I hope POSIX -dies before Perl 6 does...] - Sandboxing? maybe-r Env var? maybe -E.
Re: r24846 - docs/Perl6/Spec
pugs-comm...@feather.perl6.nl writes: > +C<--prelude=Perl6-autoloop-no-print>. Since eager matching is used, if you > +need to pass something like: > > + ++foo -bar ++foo baz ++/foo ++/foo > > +you'll end up with > + > + %+OPTS = '-bar ++foo baz'; That doesn't look very "eager" to me. Eirik -- "So this is the Sword of Immortality? Huh? What's it doin' in a CRYPT?!" --- John S. Novak, III, quoting an unnamed player
Re: r24846 - docs/Perl6/Spec
On Fri, Jan 9, 2009 at 13:16, Eirik Berg Hanssen wrote: > pugs-comm...@feather.perl6.nl writes: > >> +C<--prelude=Perl6-autoloop-no-print>. Since eager matching is used, if you >> +need to pass something like: >> >> + ++foo -bar ++foo baz ++/foo ++/foo >> >> +you'll end up with >> + >> + %+OPTS = '-bar ++foo baz'; > > That doesn't look very "eager" to me. > it's "eager" for the match to close, which is the opposite of "greedy" matching. in perl 5 documentation, it's called "non-greedy". for use and explanation of the terminology, see http://perlcabal.org/syn/S05.html#Backtracking_control. ~jerry
Re: r24846 - docs/Perl6/Spec
"jerry gay" writes: > On Fri, Jan 9, 2009 at 13:16, Eirik Berg Hanssen > wrote: >> That doesn't look very "eager" to me. >> > it's "eager" for the match to close, which is the opposite of "greedy" > matching. in perl 5 documentation, it's called "non-greedy". for use > and explanation of the terminology, see > http://perlcabal.org/syn/S05.html#Backtracking_control. > ~jerry If that's now the case, that's unfortunately confusing. In other contexts, "eagerness" is "leftmost" ("eager" for matching to start, if you like), which is orthogonal to "greed": # Perl Cookbook illustration of eagerness, expanded to demonstrate # that the non-greedy case is equivalent: $string = 'good food'; if ($greedy) { $string =~ s/o*/e/; # 'egood food' } else { $string =~ s/o*?/e/; # 'egood food' } Why not stick to "non-greedy", if that's what you mean? Surely that's not ambiguous? Eirik -- The basic facts are that the rate of decrease of the population growth rate has been falling for decades, at an ever increasing rate. --jsn...@netcom.com (John R. Snead)
Re: r24846 - docs/Perl6/Spec
On Fri, Jan 9, 2009 at 14:26, Eirik Berg Hanssen wrote: > "jerry gay" writes: > >> On Fri, Jan 9, 2009 at 13:16, Eirik Berg Hanssen >> wrote: >>> That doesn't look very "eager" to me. >>> >> it's "eager" for the match to close, which is the opposite of "greedy" >> matching. in perl 5 documentation, it's called "non-greedy". for use >> and explanation of the terminology, see >> http://perlcabal.org/syn/S05.html#Backtracking_control. >> ~jerry > > If that's now the case, that's unfortunately confusing. In other > contexts, "eagerness" is "leftmost" ("eager" for matching to start, if > you like), which is orthogonal to "greed": > ># Perl Cookbook illustration of eagerness, expanded to demonstrate ># that the non-greedy case is equivalent: >$string = 'good food'; >if ($greedy) { > $string =~ s/o*/e/; # 'egood food' >} >else { > $string =~ s/o*?/e/; # 'egood food' >} > > Why not stick to "non-greedy", if that's what you mean? Surely > that's not ambiguous? > > i agree the wording isn't clear here, but it is consistent with the current design language. i don't want to define something with a negative, so i purposefully did not use "non-greedy". i'll bring it up at the next design meeting, so the linguists can weigh in. ~jerry