Re: Getting Started - Synopsis
On Mon, Mar 31, 2008 at 8:59 PM, Ryan Richter [EMAIL PROTECTED] wrote: Sorry, it's actually the html stuff from pugs that's not making it onto feather, e.g. syn_index.html. Ah...Thanks for the catch :) The index page was formerly a symbolic link to the syn_index.html in audreyt's pugs tree which is updated by the good old evalbot and evalbot has been abandoned for months. I've pointed it to my own pugs tree on feather now, which should be updated in the same pace of the update_syn script, i.e., every one hour. I've noticed the newly-added links to the POD version of the Synopses on the index page. Very cool! Are you building it with GHC 6.6.1? I think that version doesn't work anymore. Maybe someone who's succeeded in building pugs lately can elaborate... It seems that I've been using GHC 6.8.2 on feather: [EMAIL PROTECTED]:~$ ghc -v Glasgow Haskell Compiler, Version 6.8.2, for Haskell 98, stage 2 booted by GHC version 6.6.1 I'll look into this later :) Thanks! -agentzh
Re: Getting Started - Synopsis
On 30 Mar 2008 10:32:03 -, John M. Dlugosz [EMAIL PROTECTED] wrote: I've read copies of the Synopsis documents that I've found on the web somewhere. How do I synchronize with the life copies, and hack on them? Most of the Synopses are in the official svn repos, http://svn.perl.org/perl6/doc/trunk/design/syn/ . This repos is hackable by only a very small group of people ;) S29 is currently in Pugs's repos IIRC which can be tweaked as long as you have a Pugs commit bit which is trivial to obtain. The latest S26 (draft) is in Damian's Perl6::Perldoc on CPAN which also has a copy in the Pugs repos AFAIK. The latest HTML version of all the Synopses can be found at http://perlcabal.org/syn/ , which is automatically updated from both SVN repositories every one hour by a cron job running on feather. Cheers, -agentzh
Re: Getting Started - Synopsis
On Sun, Mar 30, 2008 at 9:23 PM, Ryan Richter [EMAIL PROTECTED] wrote: Actually, that cron job hasn't been working for a long time... I've just checked the cronjob mails and it seems to me that the update-syn script is working fine. So the Synopses are still fresh :) I think you meant the auto-smoke script, which indeed has been failing due to a build error while linking pugs (after make veryclean): Linking pugs.new ... /usr/bin/perl util/gen_prelude.pl -v -i src/perl6/Prelude.pm -i ext/Math-Basic/lib/Math/Basic.pm -p ./pugs --output blib6/lib/Prelude.pm.yml # ./pugs -Iext/Math-Basic/lib -C Parse-YAML Prelude.pm blib6/lib/Prelude.pm.yml Generating precompiled Prelude, Math::Basic... pugs: Internal error: Invalid grammatical category: Bool Please file a bug report. Output is empty at util/gen_prelude.pl line 189. system: [/usr/bin/perl util/gen_prelude.pl -v -i src/perl6/Prelude.pm -i ext/Math-Basic/lib/Math/Basic.pm -p ./pugs --output blib6/lib/Prelude.pm.yml]: at util/build_pugs.pl line 600. make: *** [pugs] Error 1 It only affects the passing/failing marks for the embedded test snippets ;) I'd like to seek help to fix this :) Cheers, agentzh
Re: S02 questions and comments
On 30 Mar 2008 16:35:56 -, John M. Dlugosz [EMAIL PROTECTED] wrote: I'm reading S02.pod with version information: Last Modified: 17 Mar 2008 Number: 2 Version: 130 Meta-question 1: what is the succinct way to report this? Is the Version 130 enough? The SVN revision number is sufficient. By default we're just pretending that we're referring to the svn head. 3: I copied the file from http://svn.perl.org/perl6/doc/trunk/design/syn/ which I'm told is the up-to-date home. When I ran pod2html, I got a warning that 'encoding' is an unknown directive, and also see that the HTML title is simply TITLE. Do I need a special version of pod2html, or how do I run it properly? IMHO pod2html is old and broken in various ways. I think you should use the tools provided by Pod::Simple instead. For the Synopses on feather, we're using the podhtml.pl script (based on Pod::Simple::HTML): http://svn.pugscode.org/pugs/util/podhtm.pl Hopefully you may find it useful :) Cheers, -agentzh
Re: Micro-articles on Perl 6 Operators
On 9/18/07, Adriano Ferreira [EMAIL PROTECTED] wrote: Join me. The drafts of the introduction and the first article are here: http://ferreira.nfshost.com/perl6/intro.html http://ferreira.nfshost.com/perl6/zip.html I see the following snippet in zip.html: # import num2en from Perl 6 Lingua::EN::Numbers module use :from perl5 Lingua::EN::Numbers num2en ; Maybe you meant Perl 5 in that comment? It looks inconsistent to me ;) Nice article, BTW :) Thanks, agentz
Re: Query regarding Java/perl interface
On 6/19/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi I am sameer and am new to this group. It would realy help if any body can let me know is there a book or reference guiode where in i can get help regarding the perl/java interface and also about the tool named Java perl lingo. For the Java to Perl 5 interface, see Inline::Java on CPAN: http://search.cpan.org/dist/Inline-Java/ For a Java to Perl 6 API translator, see Java::Javap: http://search.cpan.org/perldoc?Java::Javap The author's journals may be helpful too: http://use.perl.org/~philcrow/journal Cheers, agentz
Re: New version of Perl6::Perldoc uploaded
On 4/25/07, Damian Conway [EMAIL PROTECTED] wrote: Perl6::Perldoc v0.0.5 just hit the CPAN. I think you have forgot to update the version number in Perl6::Perldoc::Parser. It's still v0.0.1: http://search.cpan.org/src/DCONWAY/Perl6-Perldoc-v0.0.5/lib/Perl6/Perldoc/Parser.pm See line 7: use version; our $VERSION = qv('0.0.1'); I'd like to say something like use Perl6::Perldoc::Parser 0.05 because smartlinks.pl in the Pugs repos is using a feature that only exists from v0.0.5. Thanks, agentz
Re: New version of Perl6::Perldoc uploaded
On 4/25/07, Damian Conway [EMAIL PROTECTED] wrote: Perl6::Perldoc v0.0.5 just hit the CPAN. Apart from several important bug-fixes, notable new features include: For another issue, I see diakopter++ has committed the source of Perl6::Perldoc from CPAN to the Pugs SVN repos. Will you commit future changes there? If not, sync'ing two different versions will be a pain and I think we should remove it from the Pugs tree. And...when will S26 be committed to the synopsis repos? The latest version of S26.pod6 seems to be bundled with the latest CPAN release of Perl6::Perldoc, which is a bit hard to sync too. :( Cheers, agentz
Re: perl6-synopsis svn
On 2/23/07, Blair Sutton [EMAIL PROTECTED] wrote: Sorry if this is a silly question but I haven't been able to find the answer. Is the perl6-synopsis SVN repository publicly available or is it in the same repository as that of Parrot or Pugs? I think you're looking for this: http://svn.perl.org/perl6/doc/trunk/design/syn/ Cheers.
When should a LAST block be triggered?
Hello~ S04 says, A NEXT executes only if the end of the loop block is reached normally, or an explicit next is executed. Then how about LAST blocks? Do they execute only if the last iteration of the loop is reached normally, or an explicit last is executed? Will return/leave/goto quietly bypass LAST blocks just like NEXT? Clarification (especially in the form of S04 updates) will be very appreciated. Thanks! Agent
Re: NEXT and the general loop statement
On 8/17/06, Larry Wall [EMAIL PROTECTED] wrote: I'd say 01234 on the theory that the 3-arg loop is really saying: $n = 0; while $n 5 { NEXT { ++$n } NEXT { print $n } } and also on the theory that block exiting blocks always run in reverse order. Dear Larry, I think it's important enough to explicitly express this rule in S04 after the following IRC conversation with Audrey: agentzh audreyt: do multiple NEXT {} run in the reversed order? audreyt I don't know, actually. audreyt I don't have a clear intuision of what makes sense. agentzh larry once said on p6l that quitting blocks should run in reversed order. audreyt I read that too. thing is, is NEXT quitting or entering... audreyt I can argue either way eloquently, which means it's best deferred to TimToady, sorry :) Cheers, Agent
Re: could 'given' blocks have a return value?
On 8/30/06, Mark Stosberg [EMAIL PROTECTED] wrote: Sometimes I use 'given' blocks to set a value. To save repeating myself on the right hand side of the given block, I found I kept want to do this: my $foo = given { } According to S04, given {} is at statement level, so you can't use it directly as an expression. But Perl 6 always allow you to say my $foo = do given {...} As well as my $foo = do if foo {...} else {...} my $rm = sub { given $rm_param { when Code { $rm_param(self) } when Hash { %rm_paramrun_mode } default{ self.query.param($rm_param) } }}(); Apparently ``do'' is a simplified version for this. :) Cheers, Agent
Questions about statement modifiers
Hi, there~ I think S04 says too little about statement modifiers. Please comment on the following code samples. Are they valid Perl 6? do { say } for 1..3; { say } for 1..3; - $i { say $i } for 1..3; And how about similar variations for other statement modifiers, such as while, given, if, until, and unless? Thanks! Agent
Integrating the Pugs test suite into the Synopses
Hi, there~ When you see the title, you may wonder what that means. Here is the answer: http://feather.perl6.nl/~agentzh/syn/S04.html Search for links named like Show the snippet from ... and click on them to find out what will happen. :) Well, in short, we have divided the .t files in the Pugs test suite into pieces and inserted every resulting snippet after the corresponding paragraph of the Synopses. The job was done by the Perl 5 script util/smartlinks.pl living in the Pugs source tree. And all the *.html under http://feather.perl6.nl/~agentzh/syn/ are updated every hour with the latest Synopses and Pugs test suite. Thanks to the cron program on feather. ;-) At this point, there is a question. How does smartlinks.pl manage to determine which snippet of the tests corresponds to which paragraph of a certain synopsis? Hmm, I'm sure you may have already found the answer from the web pages. There's hundreds of smartlinks spreading over the whole test suite in the form of comments. Here're two examples: # LS04/The do-once loop/can't put while or until modifier # LS04/Switch statements /is exactly equivalent to You see, the smartlink has its deep root in our POD, but contains an extra keyword list after the second slash. This list of keywords specifies which paragraph in the given section is relevant to the tests right below the comment. Multiple adjacent smartlinks can share the same group of tests: # LS02/Context/boolean ? # LS03/Changes to Perl 5 operators/? imposes boolean context { ... } Please see t/README in Pugs repository for more detailed information on smartlinks: http://svn.openfoundry.org/pugs/t/README Embedding test snippets into the Synopses has several benefits: * Providing more sample code to the Synopses Synopses are known for their rich samples. Unfortunately, the sample code our Synopses are not enough at all. Many sections go without sample code. On the other hand, the Pugs test suite contains tens of thousands of tests, which can certainly serve as very good examples as long as they are correct and up-to-date. * Intuitive estimation for the quality of the tests When we browse the web pages with test snippet embedded, it's quite easy to figure out the validity and also the completeness of the test suite. For instance, if a whole section has no snippet links at all, then that probably means we need to add more tests as well as smartlinks. These HTML pages are good visual coverage reports per se. Also, the correctness of a group of tests is easiest to determine if it appears right in the context of the synopses. Currently we also have TODO and SKIP marks in the test suite, hence we can get a good estimation for how much of the Synopses are implemented by Pugs at a quick glance. * Easier to detect mismatch between tests and docs Everyone who has subscribed p6l can see the Synopses are changing pretty fast. In contrast, many tests in the Pugs test suite are terribly out of date even though Larry has the habit of updating some tests after updating the documents. But if we have enough smartlinks distributed in the test suite, the mismatch between tests and docs can be detected in the form of broken links. To get a list of broken links, we only need a single command: $ util/smartlinks.pl --check t/*/*.t t/*/*/*.t Unmatched smartlinks (if any) will be reported in great detail: ERROR: t/operators/quoting.t: line 173: pattern ``/Split result on words (no quote protection)/'' failed to match any paragraph in LS02/Literals. ERROR: t/data_types/arglist.t: line 6: section ``Operator renaming'' not found in S03. As I told Juerd on #perl6, the initial motivation of developing smartlinks.pl is simply to make myself more motivated to contribute tests to Pugs. Thanks to other Pugs members who worked on the smartlinks long before I joined the Pugs team. Without their work, smartlinks.pl won't produce anything meaningful today. :) This mail is also posted to Audrey's blog in the form of HTML: http://pugs.blogs.com/pugs/2006/08/integrating_the.html POD++ Cheers, Agent
Re: Dumb doc question...
On 8/21/06, Agent Zhang [EMAIL PROTECTED] wrote: http://svn.berlios.de/svnroot/repos/unisimu/Perl/Syn/ This position is no longer maintained. Please see http://feather.perl6.nl/~agentzh/syn/ instead. The .html pages there are updated every *one* hour by the cron program on feather. So they're guaranteed to be up-to-date. Cheers, Agent
Re: Dumb doc question...
On 8/17/06, Thom Boyer [EMAIL PROTECTED] wrote: On 8/16/06, Agent Zhang [EMAIL PROTECTED] wrote: On 8/17/06, Mark J. Reed [EMAIL PROTECTED] wrote: Where can I find a pod2html that groks the p6 version of POD? I want to format my fresh-from-svn copies of the doc... And there're also an online HTML version of the Perl 6 Spec: http://dev.perl.org/perl6/doc/synopsis.html This version automatically updates from the SVN repository every few hours. With my recent work on util/smartlinks.pl in Pugs' repos, you can always browse the HTML version of Synopses with embedded code snippets from the Pugs test suite from the following location: http://svn.berlios.de/svnroot/repos/unisimu/Perl/Syn/ The HTML pages are not updated automatically like dev.perl.org, but should be updated by hand every day or two. Of course, if you have a pugs source tree, then you can generate the latest HTML version of Synopses yourselves at any time: $ util/smartlinks.pl --out-dir=tmp t/*/*.t t/*/*/*.t Unfortunately, S29 is not available there -- it only provides a pointer to http://svn.openfoundry.org/pugs/docs/Perl6/Spec/Functions.pod and the pod file just isn't as pretty as the nicely formatted HTML available for all the other synopses. Hey, the S29 living in the Pugs repos is also used by smartlinks.pl by default! Yay! Cheers, Agent
Re: Dumb doc question...
On 8/17/06, Mark J. Reed [EMAIL PROTECTED] wrote: Where can I find a pod2html that groks the p6 version of POD? I want to format my fresh-from-svn copies of the doc... If you mean the POD files of perl 6 synopses, then pod2html only lacks the support for the =encoding directive. On my (Win32) machine, there's a build.bat to generate HTML from all the synopses. It looks like this: call podhtm -s Active.css *.pod grep -P text/html; charset=gb2312 *.html | subs gb2312 UTF-8 del *.tmp where podhtm is a wrapper around a pod2html and subs is a text substitution utility written by myself. And there're also an online HTML version of the Perl 6 Spec: http://dev.perl.org/perl6/doc/synopsis.html This version automatically updates from the SVN repository every few hours. Hope these help. Agent
[patch] do EXPR
Hello~ Here is a snippet from the Pugs test suite: { my $ret = eval 'do 42'; ok(!$ret, 'do EXPR should not work', :todo); # XXX or should it? Feels weird... } which motivated me to create the following patch for S04: Index: D:/projects/Perl6-Syn/S04.pod === --- D:/projects/Perl6-Syn/S04.pod (revision 10955) +++ D:/projects/Perl6-Syn/S04.pod (working copy) @@ -349,8 +349,9 @@ $x = do if $a { $b } else { $c }; -This construct only allows you to prefix a statement. If you want to -continue the expression after the statement you must use the curly form. +This construct only allows you to prefix Ione statement (or an expression). +If you want to continue the expression after the statement you must use the +curly form. Since Cdo is defined as going in front of a statement, it follows that it can always be followed by a statement label. This is particularly Cheers, Agent
Relative running order between traits blocks
Hello, everyone~ S04 doesn't explain the running order between the traits blocks FIRST, ENTER, NEXT, LEAVE, and LAST. So I couldn't be sure whether or not my tests in the Pugs test suit are correct. Please check out the following test file, which also servers as the first sketch of my proposal: http://svn.openfoundry.org/pugs/t/closure_traits/in_loop.t Luke pointed out on #perl6 that LAST should be fired off after LEAVE if FIRST runs before ENTER. I think it's good to symmetry. Comments are very welcome. Hopefully we can end up with some sane conclusion, which can finally go into S04. :=) Regards, Agent
Apply the unpace rule into embedded comments
Hi, there~ While I was adding tests to t/syntax/comments.t in the Pugs test suit this afternoon, I suddenly came up with this form of embedded comments: my $foo = #\ (this is a comment) 42; is $foo, 42; Now that we have the excellent unspace rule, why can't we use it consistently with the embedded comment syntax? As Luke said on #perl6, although this is not an important issue at all, it's an interesting corner case in Perl 6's syntax. :=) Regards, Agent
Re: [svn:perl6-synopsis] r10758 - doc/trunk/design/syn
On 8/10/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: @@ -1339,8 +1339,8 @@ =head2 Undefined types -These can behave as values or objects of any class, but always return -a C.valid that evaluates to false. One can create them with the +These can behave as values or objects of any class, except that +Cdefined always returns false. One can create them with the built-in Cundef and Cfail functions. (See S02 for how failures are handled.) s/Cdefined /C.defined/
Patch for S06 (and also S03)
Hi, there~ I've been reading S06 in the past few days. it almost killed me due to its difficulties. ;-) The patch to S06 (as well as S03) is given at the end of the mail. I've also included several fixes from TreyHarris++ and spinclad++. I really appreciate the help from #perl6. :D There's one issue not reflected in the patch: I've got the feeling that S06 is claiming the differences between the inner type of return values and the of type over and over again, which even annoyed me while I was reading. Maybe make it less verbose a bit? On the other hand, I think the Unpacking tree node parameters section needs more explanation. The Signature and Capture bits are still fuzzy in my head after reading so many synopses. Another uncertain issue is is assoc('chain') versus is assoc('chaining'). S06 is giving a contradictory answer. I've changed the 'chaining' tag to 'chain' in the patch, BTW. Cheers, Agent Index: D:/projects/Perl6-Syn/S03.pod === --- D:/projects/Perl6-Syn/S03.pod (revision 10539) +++ D:/projects/Perl6-Syn/S03.pod (working copy) @@ -1009,7 +1009,7 @@ =head1 Junctive operators C|, C, and C^ are no longer bitwise operators (see -L/Changes to existing operators) but now serve a much higher cause: +L/Changes to Perl 5 operators) but now serve a much higher cause: they are now the junction constructors. A junction is a single value that is equivalent to multiple values. They Index: D:/projects/Perl6-Syn/S06.pod === --- D:/projects/Perl6-Syn/S06.pod (revision 10539) +++ D:/projects/Perl6-Syn/S06.pod (working copy) @@ -57,7 +57,7 @@ other constraints. They may have multliple invocants. BPrototypes (keyword: Cproto) specify the commonalities (such -as parameter names, fixity and associativity) shared by all multis +as parameter names, fixity, and associativity) shared by all multis of that name in the scope of the Cproto declaration. A modifier keyword may occur before the routine keyword in a named routine: @@ -98,7 +98,7 @@ our RETTYPE sub ( PARAMS ) TRAITS {...} # means the same as my here BTrait is the name for a compile-time (Cis) property. -See LTraits and Properties +See LProperties and traits. =head2 Perl5ish subroutine declarations @@ -244,7 +244,7 @@ An operator name consists of a grammatical category name followed by a single colon followed by an operator name specified as if it were a hash subscript (but evaluated at compile time). So any of these -indicate the same binary addition operator: +indicates the same binary addition operator: infix:+ infix:«+» @@ -271,7 +271,7 @@ sub circumfix:LEFTDELIM RIGHTDELIM ($contents) {...} sub circumfix:{'LEFTDELIM','RIGHTDELIM'} ($contents) {...} -Contrary to A6, there is no longer any rule about splitting an even +Contrary to Apocalypse 6, there is no longer any rule about splitting an even number of characters. You must use a two element slice. Such names are canonicalized to a single form within the symbol table, so you must use the canonical name if you wish to subscript the symbol table @@ -367,9 +367,9 @@ Only bare keys with valid identifier names are recognized as named arguments: doit when = 'now'; # always a named arg -doit 'when' = 'now'; # always a positonal arg -doit 123 = 'now'; # always a positonal arg -doit :123now; # always a positonal arg +doit 'when' = 'now'; # always a positional arg +doit 123 = 'now'; # always a positional arg +doit :123now; # always a positional arg Going the other way, pairs intended as named arguments that don't look like pairs must be introduced with the C[,] reduction operator: @@ -419,12 +419,13 @@ Ordinary hash notation will just pass the value of the hash entry as a positional argument regardless of whether it is a pair or not. -To pass both key and value out of hash as a positional pair, use C:p. +To pass both key and value out of hash as a positional pair, use C:p +instead: doit %hasha:p,1,2,3; doit %hash{'b'}:p,1,2,3; -instead.. (The C:p stands for pairs, not positional--the +(The C:p stands for pairs, not positional--the C:p adverb may be placed on any Hash objects to make it mean pairs instead of values.) @@ -435,7 +436,7 @@ Because named and positional arguments can be freely mixed, the programmer always needs to disambiguate pairs literals from named -arguments with parenthesis or quotes: +arguments with parentheses or quotes: # Named argument a push @array, 1, 2, :ab; @@ -453,7 +454,7 @@ fun( x = 1, x = 2 ); # @x := (1, 2) fun( x = (1, 2), x = (3, 4) );# @x := (1, 2, 3, 4) -Other sigils binds only to the Ilast argument with that name: +Other sigil binds only to the Ilast argument with that name: sub fun (Int $x) { ... } f( x = 1, x = 2 );
Re: Patch for S06 (and also S03)
On 8/8/06, Daniel Hulme [EMAIL PROTECTED] wrote: Sorry to patch the patch, but in -Other sigils binds only to the Ilast argument with that name: +Other sigil binds only to the Ilast argument with that name: the replacement makes no more sense than the original. Other sigils bind or Any other sigil binds would work here. Oh, thank you very much for pointing it out. I didn't even read the new sentence after I made the change. ;-) I should be more careful this next time. Also, I believe the original of have an explicit declarator such as Csub or Cmethod; bare blocks and -pointy subs are never considered to be routines in that sense. To return +pointy blocks are never considered to be routines in that sense. To return from a block, use Cleave instead--see below. is correct. Pointy subs are consistently known as such, and I don't see any reason to rename them: the - symbol promotes a block (and optional arg list) into an anonymous sub, and the name reflects this. I'm sorry disagree with this one since I am simply following Audrey's change on r10478: * S04, S06: Pointy sub and Pointy block was used interchangeably in the text, but as uri++ pointed out, it was very confusing as we also say that return escapes from subs but not blocks. Hence, rename all mention of pointy sub to pointy block. As Audrey said, the term pointy sub is very confusing. Thanks! Agent
Re: Patch for S06 (and also S03)
(Please ignore the previous mail. I was writing that in sleepy mode. Sorry.) On 8/8/06, Daniel Hulme [EMAIL PROTECTED] wrote: Sorry to patch the patch, but in -Other sigils binds only to the Ilast argument with that name: +Other sigil binds only to the Ilast argument with that name: the replacement makes no more sense than the original. Other sigils bind or Any other sigil binds would work here. Oh, thank you very much for correcting this. I didn't even read the sentence after I made the change. ;-) I should be more careful the next time. Also, I believe the original of have an explicit declarator such as Csub or Cmethod; bare blocks and -pointy subs are never considered to be routines in that sense. To return +pointy blocks are never considered to be routines in that sense. To return from a block, use Cleave instead--see below. is correct. Pointy subs are consistently known as such, and I don't see any reason to rename them: the - symbol promotes a block (and optional arg list) into an anonymous sub, and the name reflects this. I'm sorry that I disagree with this one since I am following Audrey's changes made as r10478: * S04, S06: Pointy sub and Pointy block was used interchangeably in the text, but as uri++ pointed out, it was very confusing as we also say that return escapes from subs but not blocks. Hence, rename all mention of pointy sub to pointy block. As Audrey said, the term pointy sub is very confusing in the context of using the return statement. I second her opinion here. :=) Thanks! Agent
Patch for S05
Hi, there~ This is my patch to S05. I've got many helps from gaal++, nothingmuch++, Aankhen``++, and many others on #perl6. :D It is mostly a story about typos as usual... :=) Cheers, Agent Index: D:/projects/Perl6-Syn/S05.pod === --- D:/projects/Perl6-Syn/S05.pod (revision 10535) +++ D:/projects/Perl6-Syn/S05.pod (working copy) @@ -94,7 +94,7 @@ m:g:i/\s* (\w*) \s* ,?/; Every modifier must start with its own colon. The delimiter must be -separated from the final modifier by whitespace if it would be taken +separated from the final modifier by whitespace if it would otherwise be taken as an argument to the preceding modifier (which is true for any bracketing character). @@ -199,7 +199,7 @@ match variants are defined for them: ms/match some words/# same as m:sigspace -ss/match some words/replace those words/ # same ss s:sigspace +ss/match some words/replace those words/ # same as s:sigspace Conjecture: This might become sufficiently idiomatic that Cms// would be better as a stuttered Cmm// instead, much as Cqq// became idiomatic. @@ -497,7 +497,7 @@ / [foo]**{1,3} / (At least, it fails in the absence of Cuse rx :listquantifier, -which is likely to be unimplemented in Perl 6.0.0 anyway). +which is likely to be unimplemented in Perl 6.0.0 anyway.) The optimizer will likely optimize away things like C**{1..*} so that the closure is never actually run in that case. But it's @@ -784,7 +784,7 @@ =item * -A leading C?{ or C!{indicates a code assertion: +A leading C?{ or C!{ indicates a code assertion: / (\d**{1..3}) ?{ $0 256 } / / (\d**{1..3}) !{ $0 256 } / @@ -1011,7 +1011,7 @@ The Perl 6 equivalents are: regex { pattern }# always takes {...} as delimiters -rx / pattern /# can take (almost any) chars as delimiters + rx/ pattern /# can take (almost any) chars as delimiters You may not use whitespace or alphanumerics for delimiters. Space is optional unless needed to distinguish from modifier arguments or @@ -1021,14 +1021,14 @@ rx ( pattern ) # okay rx( 1,2,3 ) # tries to call rx function -(This is true of all quotelike constructs in Perl 6.) +(This is true for all quotelike constructs in Perl 6.) =item * -If either form needs modifiers, they go before the opening delimiter: +If modifiers are needed by either form, they go before the opening delimiter: $regex = regex :g:s:i { my name is (.*) }; - $regex = rx:g:s:i / my name is (.*) /;# same thing + $regex = rx:g:s:i / my name is (.*) /;# same thing Space is necessary after the final modifier if you use any bracketing character for the delimiter. (Otherwise it would be taken as @@ -1050,7 +1050,7 @@ =item * As the syntax indicates, it is now more closely analogous to a Csub {...} -constructor. In fact, that analogy will run Ivery deep in Perl 6. +constructor. In fact, that analogy runs Ivery deep in Perl 6. =item * @@ -1120,10 +1120,10 @@ regex ident { [ alpha: | _: ]: \w+: } -but rather easier to read. The bare C*, C+ and C? quantifiers +but rather easier to read. The bare C*, C+, and C? quantifiers never backtrack in a Ctoken unless some outer regex has specified a C:panic option that applies. If you want to prevent even that, use -C*:, C+: or C?: to prevent any backtracking into the quantifier. +C*:, C+:, or C?: to prevent any backtracking into the quantifier. If you want to explicitly backtrack, append either a C? or a C+ to the quantifier. The C? forces minimal matching as usual, while the C+ forces greedy matching. The Ctoken declarator is @@ -1248,7 +1248,7 @@ =item * Attempting to backtrack past a C cut causes the complete match -to fail (like backtracking past a C commit . This is because there's +to fail (like backtracking past a C commit ). This is because there's now no preceding text to backtrack into. =item * @@ -1272,7 +1272,7 @@ =item * -...so too you can have anonymous regexes and Inamed regexes (and tokens, +...so too you can have anonymous regexes and Inamed regexes (as well as tokens and rules): token ident { [alpha|_] \w* } @@ -1546,7 +1546,7 @@ =item * Inside a regex, the C$/ variable holds the current regex's -incomplete CMatch object (which can be modified via the internal C$/. +incomplete CMatch object (which can be modified via the internal C$/). For example: $str ~~ / foo # Match 'foo' @@ -1651,13 +1651,13 @@ =item * The array elements of the regex's CMatch object (i.e. C$/) -store individual CMatch objects representing the substrings that where +store individual CMatch objects representing the substrings that were matched and captured by the first, second, third, etc. Ioutermost (i.e. unnested) subpatterns. So these elements can be treated like fully fledged match results. For example: if m/ (\d\d\d\d)-(\d\d)-(\d\d)
Legacy Dereferencing Syntax Used in S05
Hi, all~~ S05 makes widely use of the syntax @{ $capture } and %{ $capture } while other synopses remarkably don't. According to S02, {...} should normall be a closure or a hash subscript and S02 uses the syntax @( $arrayref ) and %( $hashref ) consistently. Is S05 simply out of sync or is the legacy dereferencing syntax still valid Perl 6 but not specified explicitly? BTW, PerlJam on #perl6 also found the uses of @{...} appear vestigial. Regards, Agent
Re: [svn:perl6-synopsis] r10487 - doc/trunk/design/syn
Audrey, I know the feeling of processing a large patch. :=) As Larry said, there're always nits. :( Here're even more fixes for S04: Index: D:/projects/Perl6-Syn/S04.pod === --- D:/projects/Perl6-Syn/S04.pod (revision 10488) +++ D:/projects/Perl6-Syn/S04.pod (working copy) @@ -23,7 +23,7 @@ Every block is a closure. (That is, in the abstract, they're all anonymous subroutines that take a snapshot of their lexical scope.) -How a block is invoked and how its results are used is a matter of +How a block is invoked and how its results are used are matters of context, but closures all work the same on the inside. Blocks are delimited by curlies, or by the beginning and end of the @@ -225,7 +225,7 @@ However, that's likely to be visually confused with a following Cwhile loop at the best of times, so it's also allowed to put the -loop conditional at the front, with the same meaning (the Crepeat +loop conditional at the front, with the same meaning. (The Crepeat keyword forces the conditional to be evaluated at the end of the loop, so it's still C's do-while semantics.) Therefore, even under GNU style rules, the previous example may be rewritten into a very clear: @@ -394,7 +394,7 @@ it's not required that all the statements in a switch block be Cwhen statements (though it helps the optimizer to have a sequence of contiguous Cwhen statements, because then it can arrange to jump -directly to the first appropriate test that might possibly match.) +directly to the first appropriate test that might possibly match). The default case: @@ -470,7 +470,7 @@ All abnormal control flow is, in the general case, handled by the exception mechanism (which is likely to be optimized away in specific -cases.) Here abnormal means any transfer of control outward that +cases). Here abnormal means any transfer of control outward that is not just falling off the end of a block. A Creturn, for example, is considered a form of abnormal control flow, since it can jump out of multiple levels of closures to the end of the scope @@ -521,8 +521,8 @@ scope of that loop, and if that call mentions the outer loop's label, then that outer loop is the one that must be controlled. (This search of lexical scopes is limited to the current official subroutine.) -If there is no such lexically scoped outer loop in the current subroutine. -Then a fallback search is made outward through the dynamic scopes in +If there is no such lexically scoped outer loop in the current subroutine, +then a fallback search is made outward through the dynamic scopes in the same way Perl 5 does. (The difference between Perl 5 and Perl 6 in this respect arises only because Perl 5 didn't have user-defined control structures, hence the sub's lexical scope was Ialways @@ -673,7 +673,7 @@ All of these trait blocks can see any previously declared lexical variables, even if those variables have not been elaborated yet when the closure is invoked (in which case the variables evaluate to an -undefined value.) +undefined value). Note: Apocalypse 4 confused the notions of CPRE/CPOST with CENTER/CLEAVE. These are now separate notions. CENTER and CLEAVE are used only for @@ -793,7 +793,7 @@ statement continuators such as Celse that cannot be confused with the beginning of a new statement. Anything else, such as a statement modifier (on, say, a Cloop statement) must continue on the same line, -unless the newline be escaped using the unspace construct--see S02.) +unless the newline be escaped using the unspace construct--see S02). Final blocks on statement-level constructs always imply semicolon precedence afterwards regardless of the position of the closing curly.
Re: [svn:perl6-synopsis] r10492 - doc/trunk/design/syn
On 7/28/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Author: audreyt Date: Thu Jul 27 10:44:22 2006 New Revision: 10492 Modified: doc/trunk/design/syn/S04.pod Log: * S04: More nits from agentzh++. (However, the period-inside-parens style, as seen in this sentence, is not changed.) Hmm, IMHO, the following styles are recommended: I really like the girl (who is so smart). I really like the girl. (She is so smart.) While the following should be abandoned: I really like the girl (who is so smart.) I really like the girl. (She is so smart). Cheers, Agent
[patch] typos in S04
This is a patch for S04. Special thanks go to cjeris++ and other kind persons on #perl6 for reviewing this. Cheers, Agent Index: D:/projects/Perl6-Syn/S04.pod === --- D:/projects/Perl6-Syn/S04.pod (revision 10479) +++ D:/projects/Perl6-Syn/S04.pod (working copy) @@ -23,7 +23,7 @@ Every block is a closure. (That is, in the abstract, they're all anonymous subroutines that take a snapshot of their lexical scope.) -How any block is invoked and how its results are used is a matter of +How a block is invoked and how its results are used are matters of context, but closures all work the same on the inside. Blocks are delimited by curlies, or by the beginning and end of the @@ -41,7 +41,7 @@ A bare closure without placeholder arguments that uses C$_ (either explicitly or implicitly) is treated as though C$_ were a -a formal parameter: +formal parameter: $func = { print if $_ }; # Same as: $func = - $_ { print if $_ }; $func(printme); @@ -473,7 +473,7 @@ cases.) Here abnormal means any transfer of control outward that is not just falling off the end of a block. A Creturn, for example, is considered a form of abnormal control flow, since it -can jump out of multiple levels of closure to the end of the scope +can jump out of multiple levels of closures to the end of the scope of the current subroutine definition. Loop commands like Cnext are abnormal, but looping because you hit the end of the block is not. The implicit break of a Cwhen block is abnormal. @@ -507,7 +507,7 @@ leave == :foo:bar:baz(1) if $leaving; -or going the other way:: +or going the other way: $leaving and :foo:bar:baz(1) == leave; @@ -521,7 +521,7 @@ scope of that loop, and if that call mentions the outer loop's label, then that outer loop is the one that must be controlled. (This search of lexical scopes is limited to the current official subroutine.) -If there is no such lexically scoped outer loop in current subroutine. +If there is no such lexically scoped outer loop in the current subroutine. Then a fallback search is made outward through the dynamic scopes in the same way Perl 5 does. (The difference between Perl 5 and Perl 6 in this respect arises only because Perl 5 didn't have user-defined @@ -568,7 +568,7 @@ of parameters. (Initialization of ordinary variables does not count--presumably the presence of a label will prevent code-movement optimizations past the label.) So, for instance, it's always possible -to goto into the next case of a Cwhen or into either the then +to Cgoto into the next case of a Cwhen or into either the then or else branch of a conditional. You may not go into a Cgiven or a Cfor, though, because that would bypass a formal parameter binding (not to mention list generation in the case of Cfor). @@ -580,7 +580,7 @@ As in Perl 5, many built-in functions simply return undef when you ask for a value out of range, or the function fails somehow. Perl 6 has -CFailure objects, which refers to an unthrown CException object in +CFailure objects, any of which refers to an unthrown CException object in C$! and knows whether it has been handled or not. If you test a CFailure for C.valid, C.defined or C.true, it causes @@ -594,7 +594,7 @@ default argument. At scope exit, C$! discards all handled exceptions from itself, then performs -a GC check for all remaining (unhandled) exceptions. If all of them are still +a GC (Garbage Collection) check for all remaining (unhandled) exceptions. If all of them are still alive (e.g. by becoming part of the return value), then they are appended to C CALLER::$! . Otherwise, it calls Cdie to throw those exceptions as a single new exception, which may then be caught with a CCATCH block in @@ -672,13 +672,13 @@ All of these trait blocks can see any previously declared lexical variables, even if those variables have not been elaborated yet when -the closure is invoked. (In which case the variables evaluate to an -undefined value.) +the closure is invoked (in which case the variables evaluate to an +undefined value). Note: Apocalypse 4 confused the notions of CPRE/CPOST with CENTER/CLEAVE. These are now separate notions. CENTER and CLEAVE are used only for their side effects. CPRE and CPOST must return boolean values that are -evaluated according to the usual Design by Contract rules. (Plus, +evaluated according to the usual Design by Contract (DBC) rules. (Plus, if you use CENTER/CLEAVE in a class block, they only execute when the class block is executed, but CPRE/CPOST in a class block are evaluated around every method in the class.) @@ -718,7 +718,7 @@ opening brace. You Imust parenthesize the expression if there is a bare block or pointy block that would be misinterpreted as the statement's block. This is regardless of whether a term or operator is expected where -the block occurs. (A block inside brackets, or used as as +the block occurs. (A block
Re: Patch for S03
Hi, Audrey~ You seemed to have missed two corrections in my patch to S03 which is now given below. (I know you're preparing for OSCON 2006 and I really don't want to bother you much. :=)) Regards, Agent Index: D:/projects/Perl6-Syn/S03.pod === --- D:/projects/Perl6-Syn/S03.pod (revision 10396) +++ D:/projects/Perl6-Syn/S03.pod (working copy) @@ -808,7 +808,7 @@ my @a = (5,6); [*] @a; # 5 * 6 = 30 -As with the all metaoperators, space is not allowed inside. The whole +As with all the other metaoperators, space is not allowed inside. The whole thing parses as a single token. A reduction operator has the same precedence as a list operator. In fact, @@ -1071,7 +1071,7 @@ =head1 Binding -A new form of assignment is present in Perl 6, called binding, used in +A new form of assignment is present in Perl 6, called binding, used in place of typeglob assignment. It is performed with the C:= operator. Instead of replacing the value in a container like normal assignment, it replaces the container itself. For instance: On 7/24/06, Audrey Tang [EMAIL PROTECTED] wrote: 在 2006/7/23 上午 7:33 時,Agent Zhang 寫到: Hello, everyone~ Here's my patch for S03. Thanks, applied (and the previous one on S02 too)! Audrey
Another patch for S02
Hi, all~ Another patch for S02 is given below. (And more patches for S03, S04, ... are coming soon.) Reading Synopses is fun, but finding typos is not so enjoyable. :P Cheers, Agent Index: D:/projects/Perl6-Syn/S02.pod === --- D:/projects/Perl6-Syn/S02.pod (revision 10373) +++ D:/projects/Perl6-Syn/S02.pod (working copy) @@ -523,7 +523,7 @@ CStr in question can provide an abstract CBuf interface somehow. Coercion to CBuf should generally invalidate the CStr interface. As a generic type CBuf may be instantiated as (or bound to) any -of Cbuf8, Cbuf16, or Cbuf32 (or to any type that provide the +of Cbuf8, Cbuf16, or Cbuf32 (or to any type that provides the appropriate CBuf interface), but when used to create a buffer CBuf defaults to Cbuf8. @@ -1033,7 +1033,7 @@ Any lexical declared with the Cis context trait is by default considered readonly outside the current lexical scope. You may add Cis rw to allow called routines to modify your value. C$_, -C$! and C$/ are Crw by default. In any event, your lexical +C$!, and C$/ are Crw by default. In any event, your lexical scope can always access the variable as if it were an ordinary Cmy; the restriction on writing applies only to called subroutines. @@ -1759,7 +1759,7 @@ (You are still free to predeclare subroutines explicitly, of course.) The postdeclaration may be in any lexical or package scope that could have made the declaration visible to the provisional call had the -declaration occurred before rather than after than the provisional +declaration occurred before rather than after the provisional call. This fixup is done only for provisional calls. If there @@ -2167,7 +2167,7 @@ infix:+ $x + $y postfix:++$x++ circumfix:[ ] [ @x ] -postcircumfix:[ ] $x[$y] or $x .[$y] +postcircumfix:[ ] $x[$y] or $x.[$y] regex_metachar:, /,/ regex_backslash:w /\w/ and /\W/ regex_assertion:* /*stuff/
Patch for S03
Hello, everyone~ Here's my patch for S03. Cheers, Agent Index: D:/projects/Perl6-Syn/S03.pod === --- D:/projects/Perl6-Syn/S03.pod (revision 10373) +++ D:/projects/Perl6-Syn/S03.pod (working copy) @@ -170,7 +170,7 @@ SIMPLE OP SIMPLE OP SIMPLE -where COP is includes any standard scalar operators in the five +where COP includes any standard scalar operators in the five precedence levels autoincrement, exponentiation, symbolic unary, multiplicative, and additive; but these are limited to standard operators that are known to return numbers, strings, or booleans. @@ -383,7 +383,7 @@ Two values are never equivalent unless they are of exactly the same type. By contrast, Ceq always coerces to string, while C== always coerces to numeric. In fact, C$a eq $b really means C~$a === ~$b and C$a == $b -means C+$a === +$b. +means C+$a === +$b. Note also that, while string hashes use Ceq semantics by default, object hashes use C=== semantics. @@ -442,7 +442,7 @@ really wanted to assign a stringified value.) A negated smart match is spelled C!~~. -=item * Unary C. calls its single argument (which must a postfix operator) +=item * Unary C. calls its single argument (which must be a postfix operator) on C$_. (It's not really a unary operator, so we put it in quotes.) =item * The C.. range operator has variants with C^ on either @@ -475,7 +475,7 @@ supports the COrdered role. 0..*# 0 .. +Inf -'a'..* # 'a' .. 'z... +'a'..* # 'a' .. 'z...' *..0# -Inf .. 0 *..*# -Inf .. +Inf, really Ordered 1.2.3..*# Any version higher than 1.2.3. @@ -569,7 +569,7 @@ Any .method method truth*match if $_.method Any Regex pattern matchmatch if $_ ~~ /$x/ Any subst substitution match* match if $_ ~~ subst -Any boolean simple expression truth* match if true given $_ +Any boolean simple expression truth* match if $x given $_ Any undef undefinedmatch unless defined $_ Any Whatever default match anything Any Any run-time dispatchmatch if infix:~~($_, $x) @@ -807,7 +807,7 @@ my @a = (5,6); [*] @a; # 5 * 6 = 30 -As with the all metaoperators, space is not allowed inside. The whole +As with all other metaoperators, space is not allowed inside. The whole thing parses as a single token. A reduction operator has the same precedence as a list operator. In fact, @@ -894,7 +894,7 @@ [[;] 1,2,3] # equivalent to [1;2;3] -Builtin reduce operators return the following identity operations: +Builtin reduce operators return the following identity values: [**]() # 1 (arguably nonsensical) [*]() # 1 @@ -1070,7 +1070,7 @@ =head1 Binding -A new form of assignment is present in Perl 6, called binding, used in +A new form of assignment is present in Perl 6, called binding, used in place of typeglob assignment. It is performed with the C:= operator. Instead of replacing the value in a container like normal assignment, it replaces the container itself. For instance: @@ -1079,7 +1079,7 @@ my $y := $x; $y = 'Perl Hacker'; -After this, both C$x and C$y contain the string Perl Hacker, since +After this, both C$x and C$y contain the string Perl Hacker, since they are really just two different names for the same variable. There is another variant, spelled C::=, that does the same thing at @@ -1184,7 +1184,7 @@ =head1 Argument List Interpolating -Perl 5 forced interpolation of a functions argument list by use of +Perl 5 forced interpolation of a function's argument list by use of the C prefix. That option is no longer available in Perl 6, so instead the C[,] reduction operator serves as an interpolator, by casting its operands to CCapture objects @@ -1229,7 +1229,7 @@ @$bar = 1,2,3; $bar[] = 1,2,3; -Some lvalues can be rather lengthy, so that second form can help keep +Some lvalues can be rather lengthy, so that the second form can help keep the arrayness of the lvalue close to the assignment operator: $foo.bar.baz.bletch.whatever.attr[] = 1,2,3; @@ -1255,7 +1255,7 @@ To interpolate a function's return value, you must say: -push [,] func() +push [,] func(); Within the argument list of a C[,], function return values are automatically exploded into their various parts, as if you'd said: @@ -1346,7 +1346,7 @@ print Name: $name; Zip code: $zip\n; } -Czip has an infix synonym, the Unicode operator C¥, and its the ASCII +Czip has an infix synonym, the Unicode operator C¥, and its ASCII equivalent CY. To read arrays in parallel like Czip but just sequence the values
Patch for S02
Hi, all~ I found some nits while copying Perl 6 Synopsis 2 by hand. The patch created by my TortoiseSVN for S02 has been pasted at the end of the mail. Cheers, Agent Index: D:/projects/Perl6-Syn/S02.pod === --- D:/projects/Perl6-Syn/S02.pod (revision 10313) +++ D:/projects/Perl6-Syn/S02.pod (working copy) @@ -743,8 +743,8 @@ $args = \3; # same as $args = \(3) $$args; # same as $args as Scalar or Scalar($args) -@$args; # same as '$args as Array or Array($args) -%$args; # same as '$args as Hash or Hash($args) +@$args; # same as $args as Array or Array($args) +%$args; # same as $args as Hash or Hash($args) When cast into an array, you can access all the positional arguments; into a hash, all named arguments; into a scalar, its invocant. @@ -789,7 +789,7 @@ Whitespace is not allowed before the parens, but there is a corresponding C.() operator, plus the long dot forms that allow -you to insert optional whitespace and comments between dots: +you to insert optional whitespace and comments between the backslash and dot: foo\ .($arg1, $arg2); foo\#[ @@ -1064,7 +1064,7 @@ not see any lexical variables or their values, unless you copy those values into C%*ENV to change what subprocesses see: -temp %*ENV{LANG} = $+LANG; # may be modifed by parent +temp %*ENV{LANG} = $+LANG; # may be modified by parent system greet; =item *