[svn:perl6-synopsis] r13574 - doc/trunk/design/syn

2007-02-08 Thread larry
Author: larry
Date: Thu Feb  8 09:43:50 2007
New Revision: 13574

Modified:
   doc/trunk/design/syn/S03.pod

Log:
Unconjectured the directed hyper semantics on trees per feedback from
GPU-programming lambdafolk via audreyt++.


Modified: doc/trunk/design/syn/S03.pod
==
--- doc/trunk/design/syn/S03.pod(original)
+++ doc/trunk/design/syn/S03.podThu Feb  8 09:43:50 2007
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 8 Mar 2004
-  Last Modified: 5 Feb 2007
+  Last Modified: 8 Feb 2007
   Number: 3
-  Version: 99
+  Version: 100
 
 =head1 Overview
 
@@ -2682,9 +2682,8 @@
 is one of the ways that you can promise to the optimizer that your
 code is parallelizable.  (The tree visitation above is allowed to
 have side effects, but it is erroneous for the meaning of those side
-effects to depend on the order of visitation.  [Conjecture: we could
-allow dependencies that assume top-down visitation and only leaves
-sibling calls unordered.])
+effects to depend on the order of visitation in any way.  Hyper tree
+visitation is not required to follow DAG semantics, at least by default.)
 
 Even in the absence of hardware that can do parallel processing,
 hyperoperators may be faster than the corresponding scalar operators


[svn:perl6-synopsis] r13575 - doc/trunk/design/syn

2007-02-08 Thread larry
Author: larry
Date: Thu Feb  8 13:04:46 2007
New Revision: 13575

Modified:
   doc/trunk/design/syn/S02.pod

Log:
Added mother-of-all-quoting-forms Q// for compositional sanity.
qn// is now gone, since Q// does that without having to "undo" a q//.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podThu Feb  8 13:04:46 2007
@@ -1917,6 +1917,26 @@
 
 =item *
 
+In addition to C and C, there is now the base form C which does
+I interpolation unless explicitly modified to do so.  So C is really
+short for C and C is short for C.  In fact, all quote-like
+forms derive from C with adverbs:
+
+q// Q :q //
+qq//Q :qq //
+rx//Q :regex //
+s///Q :subst ///
+tr///   Q :trans ///
+
+Adverbs such as C<:regex> change the language to be parsed by switching
+to a different parser.  This can completely change the interpreation
+of any subsequent adverbs as well as the quoted material itself.
+
+q:s//   Q :q :scalar //
+rx:s//  Q :regex :sigspace //
+
+=item *
+
 Generalized quotes may now take adverbs:
 
 Short   LongMeaning
@@ -1924,8 +1944,6 @@
 :x  :exec   Execute as command and return results
 :w  :words  Split result on words (no quote protection)
 :ww :quotewords Split result on words (with quote protection)
-:t  :to Interpret result as heredoc terminator
-:n  :none   No escapes at all (unless otherwise adverbed)
 :q  :single Interpolate \\, \q and \' (or whatever)
 :qq :double Interpolate with :s, :a, :h, :f, :c, :b
 :s  :scalar Interpolate $ vars
@@ -1934,6 +1952,10 @@
 :f  :function   Interpolate & calls
 :c  :closureInterpolate {...} expressions
 :b  :backslash  Interpolate \n, \t, etc. (implies :q at least)
+:to Parse result as heredoc terminator
+:regex  Parse as regex
+:subst  Parse as substitution
+:trans  Parse as transliteration
 :code   Quasiquoting
 
 Ordinarily the colon is required on adverbs, but the C declarator
@@ -1941,11 +1963,11 @@
 without an intervening colon:
 
 quote qw;   # declare a P5-esque qw// meaning q:w
-quote qn;   # completely raw quote qn//
-quote qnc;  # q:n:c//, interpolate only closures
+quote Qc;   # Q:c//, interpolate only closures
 
-Actually, the first two are already assumed, because you get all of the
-forms that use as single character predeclared for free.
+Actually, those two are already assumed, because you get all of the
+forms that use a single character modifier predeclared for free.  (Note
+this means that C doesn't intepolate.)
 
 If you want to abbreviate further, you may also give an explicit
 definition as either a string or quasiquote:
@@ -1957,28 +1979,28 @@
 In particular, all these forms disable the lookahead for an adverbial argument,
 as if there were a space after the keyword.  So although
 
-q:n($foo)
+q:s($foo)
 
-will misinterpret C<$foo> as the C<:n> argument,
+will misinterpret C<$foo> as the C<:s> argument,
 
-qn(stuff)
+qs(stuff)
 
-has the advantage of misinterpreting it as the argument to the C
+has the advantage of misinterpreting it as the argument to the C
 function instead.  C<:)>
 
 But parens are special that way.  (Even C is assumed to be a
 function call rather than a quote.)  Other bracketing characters are
 special only if they can be mistaken for adverbial arguments, so
 
-qn[stuff]
+qs[stuff]
 
 is fine, and means
 
-q:n /stuff/
+q:s /stuff/
 
 while
 
-q:n[stuff]
+q:s[stuff]
 
 also happens to work because quote adverbs only allow the paren form of
 bracketed adverbs.
@@ -1987,16 +2009,16 @@
 adverbs and operators as standard macros.  The main difference is that,
 unlike
 
-quote qn = 'q:n';
+quote qs = 'q:s';
 
 declaring something like
 
-macro qn { 'q:n' }
+macro qs { 'q:s' }
 
 does I disable the subsequent search for a parenthesized argument
 to C<:n>.  To get the equivalent, you need to add a space:
 
-macro qn { 'q:n ' }
+macro qs { 'q:s ' }
 
 All the uppercase adverbs are reserved for user-defined quotes.
 All Unicode delimiters above Latin-1 are reserved for user-defined quotes.


[svn:perl6-synopsis] r13576 - doc/trunk/design/syn

2007-02-08 Thread larry
Author: larry
Date: Thu Feb  8 13:08:10 2007
New Revision: 13576

Modified:
   doc/trunk/design/syn/S02.pod

Log:
typo, plus forgot to bump version


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podThu Feb  8 13:08:10 2007
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 10 Aug 2004
-  Last Modified: 7 Feb 2007
+  Last Modified: 8 Feb 2007
   Number: 2
-  Version: 84
+  Version: 85
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -1929,7 +1929,7 @@
 tr///   Q :trans ///
 
 Adverbs such as C<:regex> change the language to be parsed by switching
-to a different parser.  This can completely change the interpreation
+to a different parser.  This can completely change the interpretation
 of any subsequent adverbs as well as the quoted material itself.
 
 q:s//   Q :q :scalar //


Re: Negative array subscripts

2007-02-08 Thread Blair Sutton

Rafael Garcia-Suarez wrote:

Smylers wrote in perl.perl6.language :
  

Hmmm, a pragma's a bit heavyweight for this; how about being able to set
this with a special global variable -- that sure sounds handy ...



Actually, in perl 5, $[ *is* a pragma... :)

  

A feature I have never felt the need to use but useful in any case. I
suspect there is a way in Perl 6 to specify Parrot grammar directives
that could adjust this behaviour? Maybe even allow you to use named
numbers as well as digits, i.e. @a[zero], @b[twelve]... :)



[svn:perl6-synopsis] r13577 - doc/trunk/design/syn

2007-02-08 Thread larry
Author: larry
Date: Thu Feb  8 13:52:24 2007
New Revision: 13577

Modified:
   doc/trunk/design/syn/S04.pod
   doc/trunk/design/syn/S05.pod
   doc/trunk/design/syn/S06.pod
   doc/trunk/design/syn/S12.pod

Log:
Unified proto processing to implicitly allow redeclarations within scope.
This works on most declarators, including regex, token, rule, and variables.
Multiple my declarations warn about redeclaration as suggested by lukastic++.
This may be suppressed with a "proto" declaration of the variable.
The "multi" keyword is now optional in the scope of a proto.
The "unique" keyword now "undoes" an outer "proto".


Modified: doc/trunk/design/syn/S04.pod
==
--- doc/trunk/design/syn/S04.pod(original)
+++ doc/trunk/design/syn/S04.podThu Feb  8 13:52:24 2007
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 19 Aug 2004
-  Last Modified: 29 Jan 2007
+  Last Modified: 8 Feb 2007
   Number: 4
-  Version: 50
+  Version: 51
 
 This document summarizes Apocalypse 4, which covers the block and
 statement syntax of Perl.
@@ -75,6 +75,15 @@
 my $x;
 my $x;
 
+By default the second declaration will get a compiler warning.
+You may suppress this by modifying the first declaration
+with C:
+
+my proto $x;
+...
+while my $x = @x.shift {...}  # no warning
+while my $x = @x.shift {...}  # no warning
+
 If you've referred to C<$x> prior to the first declaration, and the compiler
 tentatively bound it to C<$OUTER::x>, then it's an error to declare it, and
 the compiler is required to complain at that point.  If such use can't

Modified: doc/trunk/design/syn/S05.pod
==
--- doc/trunk/design/syn/S05.pod(original)
+++ doc/trunk/design/syn/S05.podThu Feb  8 13:52:24 2007
@@ -14,9 +14,9 @@
Maintainer: Patrick Michaud <[EMAIL PROTECTED]> and
Larry Wall <[EMAIL PROTECTED]>
Date: 24 Jun 2002
-   Last Modified: 5 Feb 2007
+   Last Modified: 8 Feb 2007
Number: 5
-   Version: 50
+   Version: 51
 
 This document summarizes Apocalypse 5, which is about the new regex
 syntax.  We now try to call them I rather than "regular
@@ -670,17 +670,19 @@
 
 =item *
 
-Alternatively, if you predeclare a category, you can write multiple
-rules for the same category, differentiated only by the symbol they
+Alternatively, if you predeclare a proto regex, you can write multiple
+regexes for the same category, differentiated only by the symbol they
 match:
 
-category sigil;
-token sigil { :<$> }
-token sigil { :<@> }
-token sigil { :<@@> }
-token sigil { :<%> }
-token sigil { :<&> }
-token sigil { :<::> }
+proto token sigil;
+multi token sigil { :<$> }
+multi token sigil { :<@> }
+multi token sigil { :<@@> }
+multi token sigil { :<%> }
+multi token sigil { :<&> }
+multi token sigil { :<::> }
+
+(The C is optional and generally omitted with a grammar.)
 
 This can be viewed as a form of multiple dispatch, except that it's
 based on longest-token matching rather than signature matching.  The
@@ -688,6 +690,11 @@
 rules to the same category in a derived grammar.  All of them will
 be matched in parallel when you try to match C<< // >>.
 
+If there are formal parameters on multi regex methods, matching
+still proceeds via longest-token rules first.  If that results in a
+tie, a normal multiple dispatch is made using the arguments to the
+remaining variants, assuming they can be differentiated by type.
+
 =item *
 
 An interpolated hash matches the longest possible token.  The match

Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podThu Feb  8 13:52:24 2007
@@ -58,7 +58,11 @@
 
 B (keyword: C) specify the commonalities (such
 as parameter names, fixity, and associativity) shared by all multis
-of that name in the scope of the C declaration.
+of that name in the scope of the C declaration.  A C
+also forces all routines of the same short name within the scope to
+be considered C whether they are explicitly declared so or not.
+(This is particularly useful when adding to rule sets or when attempting
+to compose conflicting methods from roles.)
 
 A modifier keyword may occur before the routine keyword in a named routine:
 

Modified: doc/trunk/design/syn/S12.pod
==
--- doc/trunk/design/syn/S12.pod(original)
+++ doc/trunk/design/syn/S12.podThu Feb  8 13:52:24 2007
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 27 Oct 2004
-  Last Modified: 3 Feb 2007
+  Last Modified: 8 Feb 2007
   Number: 12
-  Version: 38
+  Version: 39
 
 =head1 Overview
 
@@ -729,7 +729,

recent changes

2007-02-08 Thread Larry Wall
If you folks are wondering what's driving the flurry of recent synopsis
changes, it's the Perl 6 grammar written in Perl 6 that I've been working
on for the last week, and thinking about for the last month.  If you
want to peek at the current snapshot, it's at:

http://svn.pugscode.org/pugs/src/perl6/Perl-6.0.0-STD.pm

Questions and feedback welcome, but please don't follow up to this
message--start a new thread for a new topic.  Bear in mind that
this is completely untested code, still fairly buggy and incomplete.
Not even pugs can parse it (yet).  Nevertheless, I think it will help
ground some of the discussion here to have a real grammar to look at,
written in something close to our favorite language.  :)

If you use vim, the perl6.vim in pugs/util directory will do a semi-decent
job of hilighting.  Feel free to patch perl6.vim where it doesn't.

If you want to work on some part of the grammar, that's fine, but
either update frequently with svn or let me know which parts I should
leave alone while you work on them.

Larry


Re: recent changes

2007-02-08 Thread Larry Wall
I should also point out that I'm excruciatingly grateful for all the
prior art in the various Perl 6 parsers that various random geniuses
have been working on.  In particular:

pmichaud++
fglock++
putter++
audreyt++

Their parsers actually work, unlike mine.  :)

Larry


Re: Negative array subscripts

2007-02-08 Thread Blair Sutton

Rafael Garcia-Suarez wrote:

Smylers wrote in perl.perl6.language :
  

Hmmm, a pragma's a bit heavyweight for this; how about being able to set
this with a special global variable -- that sure sounds handy ...



Actually, in perl 5, $[ *is* a pragma... :)

  
A feature I have never felt the need to use but useful in any case. I 
suspect there is a way in Perl 6 to specify Parrot grammar directives 
that could adjust this behaviour? Maybe even allow you to use named 
numbers as well as digits, i.e. @a[zero], @b[twelve]... :)


[svn:perl6-synopsis] r13578 - doc/trunk/design/syn

2007-02-08 Thread larry
Author: larry
Date: Thu Feb  8 18:18:06 2007
New Revision: 13578

Modified:
   doc/trunk/design/syn/S02.pod

Log:
typo from dataweaver++


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podThu Feb  8 18:18:06 2007
@@ -2612,7 +2612,7 @@
 
 @result = @x.grep:{...};
 
-However, this I is strictly a syntactic transformation,
+However, this I is strictly a syntactic transformation,
 so a list computed any other way will not triger the rewrite:
 
 @result = (@x = each(@y)) ~~ {...}; # not a comprehension


[svn:perl6-synopsis] r13579 - doc/trunk/design/syn

2007-02-08 Thread larry
Author: larry
Date: Thu Feb  8 18:27:11 2007
New Revision: 13579

Modified:
   doc/trunk/design/syn/S02.pod

Log:
typo from all_beryb++ :)


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podThu Feb  8 18:27:11 2007
@@ -2613,7 +2613,7 @@
 @result = @x.grep:{...};
 
 However, this I is strictly a syntactic transformation,
-so a list computed any other way will not triger the rewrite:
+so a list computed any other way will not trigger the rewrite:
 
 @result = (@x = each(@y)) ~~ {...}; # not a comprehension
 


Re: recent changes

2007-02-08 Thread Audrey Tang

在 Feb 9, 2007 5:17 AM 時,Larry Wall 寫到:

Questions and feedback welcome, but please don't follow up to this
message--start a new thread for a new topic.  Bear in mind that
this is completely untested code, still fairly buggy and incomplete.
Not even pugs can parse it (yet).


Note: After some typo fixes and minor workarounds, Pugs now parses it  
just fine -- the task now is how to run it, and run it _fast_, before  
we make it part of sanity. :-)


Cheers,
Audrey