r28169 - docs/Perl6/Spec
Author: lwall Date: 2009-09-02 19:09:15 +0200 (Wed, 02 Sep 2009) New Revision: 28169 Modified: docs/Perl6/Spec/S05-regex.pod Log: [S05] document how :my works in regexen Modified: docs/Perl6/Spec/S05-regex.pod === --- docs/Perl6/Spec/S05-regex.pod 2009-09-02 16:35:17 UTC (rev 28168) +++ docs/Perl6/Spec/S05-regex.pod 2009-09-02 17:09:15 UTC (rev 28169) @@ -16,8 +16,8 @@ Created: 24 Jun 2002 -Last Modified: 11 Aug 2009 -Version: 101 +Last Modified: 2 Sep 2009 +Version: 102 This document summarizes Apocalypse 5, which is about the new regex syntax. We now try to call them I rather than "regular @@ -554,6 +554,29 @@ m:fuzzy(fuzzyargs); pattern ; +=item * + +Any grammar regex is really just a kind of method, and you may +declare variables in such a routine using a colon followed by any +scope declarator parsed by the Perl6 grammar, including C, +C, C, and C. A single statement (up through +a terminating semicolon) is parsed as normal Perl 6 code: + +token prove-nondeterministic-parsing { +:my $threshold = rand; +'maybe' \s+ +} + +Such declarations do not terminate longest-token-matching, +so an otherwise useless declaration may be used as a peg +to hang side effects on without changing how the subsequent +pattern matches: + +rule breaker { +:state $ = say "got here at least once"; +... +} + =back =head1 Changed metacharacters
r28171 - docs/Perl6/Spec
Author: lwall Date: 2009-09-02 20:21:39 +0200 (Wed, 02 Sep 2009) New Revision: 28171 Modified: docs/Perl6/Spec/S03-operators.pod Log: [S03] forbid List and Range as endpoint to ranges Modified: docs/Perl6/Spec/S03-operators.pod === --- docs/Perl6/Spec/S03-operators.pod 2009-09-02 17:40:44 UTC (rev 28170) +++ docs/Perl6/Spec/S03-operators.pod 2009-09-02 18:21:39 UTC (rev 28171) @@ -14,8 +14,8 @@ Created: 8 Mar 2004 -Last Modified: 31 Aug 2009 -Version: 171 +Last Modified: 2 Sep 2009 +Version: 172 =head1 Overview @@ -1080,17 +1080,23 @@ $min ..^ $max $min ^..^ $max -Constructs Range objects, optionally excluding one or both endpoints. +Constructs C objects, optionally excluding one or both endpoints. See L. -Note that these differ: +Ranges do no coercions, and are defined specifically for numeric +or stringish arguments (including enumerated types); in particular, +it is illegal to use a C or a C as implicitly numeric: 0 ..^ 10 # 0 .. 9 -0 .. ^10 # 0 .. (0..9) +0 .. ^10 # ERROR -(It's not yet clear what the second one should mean, but whether it -succeeds or fails, it won't do what you want.) +However, C types in the second argument are assumed to be intended as numeric: +0 ..^ @x# okay +0 ..^ +...@x # same thing + +C types are also supported. See L. + =back =head2 Chaining binary precedence
r28172 - docs/Perl6/Spec
Author: lwall Date: 2009-09-02 21:48:23 +0200 (Wed, 02 Sep 2009) New Revision: 28172 Modified: docs/Perl6/Spec/S01-overview.pod Log: [S01] also allow a .p6 to be indicative of Perl 6 code Modified: docs/Perl6/Spec/S01-overview.pod === --- docs/Perl6/Spec/S01-overview.pod2009-09-02 18:21:39 UTC (rev 28171) +++ docs/Perl6/Spec/S01-overview.pod2009-09-02 19:48:23 UTC (rev 28172) @@ -13,8 +13,8 @@ Created: 10 Aug 2004 -Last Modified: 30 Jan 2007 -Version: 6 +Last Modified: 2 Sep 2009 +Version: 7 This document originally summarized Apocalypse 1, which covers the initial design concept. That original summary may be found below @@ -111,6 +111,9 @@ use v6.0; v6; +Also, a file with a C<.p6> extension may be taken as indicative, +though C<.pl> is perfectly acceptable with one of the other indicators. + =item * Migration in the other direction is also important. In PerlĀ 6
r28173 - docs/Perl6/Spec
Author: lwall Date: 2009-09-02 21:56:15 +0200 (Wed, 02 Sep 2009) New Revision: 28173 Modified: docs/Perl6/Spec/S02-bits.pod Log: [S02] document Rat and Complex literals Modified: docs/Perl6/Spec/S02-bits.pod === --- docs/Perl6/Spec/S02-bits.pod2009-09-02 19:48:23 UTC (rev 28172) +++ docs/Perl6/Spec/S02-bits.pod2009-09-02 19:56:15 UTC (rev 28173) @@ -13,8 +13,8 @@ Created: 10 Aug 2004 -Last Modified: 31 Aug 2009 -Version: 176 +Last Modified: 2 Sep 2009 +Version: 177 This document summarizes Apocalypse 2, which covers small-scale lexical items and typological issues. (These Synopses also contain @@ -2553,6 +2553,38 @@ =item * +Rational literals are indicated by separating two integer literals +(in any radix) with a slash. Whitespace is not allowed on either +side of the slash: + +1/2 # one half literal Rat +1 / 2 # 1 divided by 2 (also produces a Rat by constant folding) + +Note that this essentially overrides precedence to produce a term, so: + +1/2 * 3/4 + +means + +(1 / 2) * (3 / 4) + +rather than + +((1 / 2) * 3) / 4 + +=item * + +Complex literals are similarly indicated by writing an addition of +two real numbers without spaces: + +5.2+1e42i + +As with rational literals, constant folding would produce the same +complex number, but this form parses as a single term, ignoring +surrounding precedence. + +=item * + Characters indexed by hex numbers can be interpolated into strings by introducing with C<"\x">, followed by either a bare hex number (C<"\x263a">) or a hex number in square brackets (C<"\x[263a]">).
Perl 6 filename extensions (was Re: r28172 - docs/Perl6/Spec)
pugs-comm...@feather.perl6.nl wrote: Author: lwall Date: 2009-09-02 21:48:23 +0200 (Wed, 02 Sep 2009) New Revision: 28172 Modified: docs/Perl6/Spec/S01-overview.pod Log: [S01] also allow a .p6 to be indicative of Perl 6 code @@ -111,6 +111,9 @@ use v6.0; v6; +Also, a file with a C<.p6> extension may be taken as indicative, +though C<.pl> is perfectly acceptable with one of the other indicators. On the face of it, I think this is a bad idea, at least exactly as stated. Fundamentally, I believe that the canonical Perl 6 filename extensions should be exactly the same as those for Perl 5, meaning .pl, .pm, .pod, .t, etc, or no language-specific filename extension at all. That is, *unless*, the new filename is meant to replace *both* .pl and .pm, and the other language-specific extensions. So if we're talking about a single unified canonical filename extension for Perl 6, for both main programs and modules etc, then I welcome it. And this then is also sort of a reversion to the Perl 4 norm of using .pl for everything. I do *not* think it is a good idea to allow .p6 as an alternative for .pl specifically, but still also keep just .pm unchanged. This would be rather an imbalance where some kind of Perl files (main programs) can have a special new extension indicating Perl 6 while Perl modules lack the ability to distinguish that way. However, I believe that it is still a good idea to change the details if we want to have a 6 in the filename. If we keep separate canonical extensions for main programs and for modules, we should simply keep the full existing extension and add a 6 to it. For example, have .pl6, .pm6, .pod6, .t6, etc if we want to have multiple canonical extensions. Or to both change and unify, I propose that .pl6 is better than .p6, because that more clearly states that we're talking about Perl 6 and not say Python 6 or Pascal 6 or PHP 6 or whatever, all of which already have filename extensions starting with "p" and that differ by other letters or lack thereof. -- Darren Duncan
Re: Perl 6 filename extensions (was Re: r28172 - docs/Perl6/Spec)
I thought I recalled seeing that the new convention was .p6m, .p6l, etc. I guess that idea was abandoned? -- Mark J. Reed
r28174 - docs/Perl6/Spec
Author: lwall Date: 2009-09-03 02:00:53 +0200 (Thu, 03 Sep 2009) New Revision: 28174 Modified: docs/Perl6/Spec/S01-overview.pod Log: [S01] generalize .p6 slightly as suggested by dduncan++ Modified: docs/Perl6/Spec/S01-overview.pod === --- docs/Perl6/Spec/S01-overview.pod2009-09-02 19:56:15 UTC (rev 28173) +++ docs/Perl6/Spec/S01-overview.pod2009-09-03 00:00:53 UTC (rev 28174) @@ -112,7 +112,10 @@ v6; Also, a file with a C<.p6> extension may be taken as indicative, -though C<.pl> is perfectly acceptable with one of the other indicators. +as may any other extension containing the digit C<6>, such as C +or C or C or C. (Though C<.pl> and C<.pm> are still +perfectly acceptable extensions as long as the Perl-6-ness is indicated +one of the other indicators.) =item *
r28175 - docs/Perl6/Spec
Author: lwall Date: 2009-09-03 07:18:16 +0200 (Thu, 03 Sep 2009) New Revision: 28175 Modified: docs/Perl6/Spec/S02-bits.pod Log: [S02] some clarification of $*foo searching Modified: docs/Perl6/Spec/S02-bits.pod === --- docs/Perl6/Spec/S02-bits.pod2009-09-03 00:00:53 UTC (rev 28174) +++ docs/Perl6/Spec/S02-bits.pod2009-09-03 05:18:16 UTC (rev 28175) @@ -14,7 +14,7 @@ Created: 10 Aug 2004 Last Modified: 2 Sep 2009 -Version: 177 +Version: 178 This document summarizes Apocalypse 2, which covers small-scale lexical items and typological issues. (These Synopses also contain @@ -2110,16 +2110,17 @@ =item * The C pseudo-package is just like C except that -it starts in the current dynamic scope and from there -scans outward through all dynamic scopes until it finds a -contextual variable of that name in that context's lexical scope. -(Use of C<$*FOO> is equivalent to C<< CONTEXT::<$FOO> >> or C<< $CONTEXT::FOO >>.) -If after scanning all the lexical scopes of each dynamic scope, -there is no variable of that name, it looks in the C package followed -by the C package. -If there is no such package variable, -it then looks in C<< CONTEXT::<%ENV> >> for the identifier of the variable, -which, if not overridden in a dynamic scope, finds C<< PROCESS::<%ENV> >>, +it starts in the current dynamic scope and from there scans outward +through all dynamic scopes until it finds a contextual variable of that +name in that dynamic context's associated lexical pad. (This search +is implied for variables with the C<*> twigil; hence C<$*FOO> is +equivalent to C<< CONTEXT::<$*FOO> >>.) If, after scanning outward +through all those dynamic scopes, there is no variable of that name +in any immediately associated lexical pad, it looks in the C +package followed by the C package. If there is no such +package variable, it then looks in C<< CONTEXT::<%*ENV> >> for the +identifier of the variable, which, if not overridden in a dynamic +scope, rescans outward and eventually finds C<< PROCESS::<%*ENV> >>, that is, in the environment variables passed to program. If the value is not found there, it returns failure. If the variable is of the form C<$*FOO>, the complete environment value is returned. If it @@ -2135,8 +2136,8 @@ my $*foo ::= CALLER::<$*foo>; -The C maybe used without an initializer on a contextual variable -to perform a similar operation: +The C declarator may be used (without an initializer) on a +contextual variable to perform a similar operation: temp $*foo; @@ -2147,6 +2148,13 @@ because you'd want to override it later and then forget the changes at the end of the current dynamic scope. +You may also use C<< OUTER::<$*foo> >> to mean you want to start the +search in your outer lexical scope, but this will succeed only if +that outer lexical scope also happens to be be one of your current +I scopes. That is, the same search is done as with the bare +C<$*foo>, but any "hits" are ignored until we've got to the C +scope in our traversal. + The C package is primarily for internal overriding of contextual information, modelled on how environmental variables work among processes. Despite the fact that the C package reflects the