Re: r26938 - docs/Perl6/Spec

2009-05-26 Thread John M. Dlugosz

I fixed that today... will check in in a few hours.
It's harder to come up with a new example than to update syntax. :)

--John



Eirik Berg Hanssen Eirik-Berg.Hanssen-at-allverden.no |Perl 6| wrote:

pugs-comm...@feather.perl6.nl writes:

  

 statement, or if you want to attach multiple statements. you must either
 use the curly form or surround the entire expression in brackets of some sort:
 
-@primes = (do (do $_ if .prime) for 1..100);

+@primes = do $_ if prime($_) for 1..100;



  I haven't been following much, but I'm pretty sure this example now
contradicts what it was once intended to illustrate, as the "entire
expression" is no longer "surrounded in" any kind of bracket.

  Is the whole you-must-either clause now obsolete?  Then I won't
bother to suggest that the Y should be upcased. ;-)


Eirik
  




Re: r26938 - docs/Perl6/Spec

2009-05-26 Thread Eirik Berg Hanssen
pugs-comm...@feather.perl6.nl writes:

>  statement, or if you want to attach multiple statements. you must either
>  use the curly form or surround the entire expression in brackets of some 
> sort:
>  
> -@primes = (do (do $_ if .prime) for 1..100);
> +@primes = do $_ if prime($_) for 1..100;

  I haven't been following much, but I'm pretty sure this example now
contradicts what it was once intended to illustrate, as the "entire
expression" is no longer "surrounded in" any kind of bracket.

  Is the whole you-must-either clause now obsolete?  Then I won't
bother to suggest that the Y should be upcased. ;-)


Eirik
-- 
Boston's Irreversible Law of Clutter: 
 In any household, junk accumulates to fill the space available 
 for its storage. 


r26938 - docs/Perl6/Spec

2009-05-25 Thread pugs-commits
Author: jdlugosz
Date: 2009-05-26 02:14:51 +0200 (Tue, 26 May 2009)
New Revision: 26938

Modified:
   docs/Perl6/Spec/S04-control.pod
Log:
[S04] update code under "do-once loop" in line with current specs.
Move a paragraph that was interfering with the antecedent of the following 
paragraph.

Modified: docs/Perl6/Spec/S04-control.pod
===
--- docs/Perl6/Spec/S04-control.pod 2009-05-25 23:55:20 UTC (rev 26937)
+++ docs/Perl6/Spec/S04-control.pod 2009-05-26 00:14:51 UTC (rev 26938)
@@ -518,27 +518,23 @@
 statement, or if you want to attach multiple statements. you must either
 use the curly form or surround the entire expression in brackets of some sort:
 
-@primes = (do (do $_ if .prime) for 1..100);
+@primes = do $_ if prime($_) for 1..100;
 
 Since a bare expression may be used as a statement, you may use C
 on an expression, but its only effect is to function as an unmatched
 left parenthesis, much like the C<$> operator in Haskell.  That is,
 precedence decisions do not cross a C boundary, and the missing
 "right paren" is assumed at the next statement terminator or unmatched
-bracket.  A C is assumed immediately after any opening bracket,
+bracket.  A C is unnecessary immediately after any opening bracket as
+the syntax inside brackets is a semicolon-separated list of statements,
 so the above can in fact be written:
 
-@primes = (($_ if .prime) for 1..100);
+@primes = ($_ if prime($_) for 1..100);
 
 This basically gives us list comprehensions as rvalue expressions:
 
-(for 1..100 { $_ if .prime}).say
+(for 1..100 { $_ if prime($_)}).say
 
-Since C is defined as going in front of a statement, it follows
-that it can always be followed by a statement label.  This is particularly
-useful for the do-once block, since it is offically a loop and can take
-therefore loop control statements.
-
 Another consequence of this is that any block just inside a
 left parenthesis is immediately called like a bare block, so a
 multidimensional list comprehension may be written using a block with
@@ -550,6 +546,11 @@
 
 @names = ({ "$^name.$^num" } for 'a'..'zzz' X 1..100);
 
+Since C is defined as going in front of a statement, it follows
+that it can always be followed by a statement label.  This is particularly
+useful for the do-once block, since it is offically a loop and can take
+therefore loop control statements.
+
 =head2 Statement-level bare blocks
 
 Although a bare block occuring as a single statement is no longer