Skip to content

Commit

Permalink
Merge branch 'master' into types
Browse files Browse the repository at this point in the history
  • Loading branch information
MorayJ committed Aug 29, 2018
2 parents 38b6495 + ec6d63c commit d1bb59e
Show file tree
Hide file tree
Showing 45 changed files with 546 additions and 420 deletions.
2 changes: 1 addition & 1 deletion doc/Language/5to6-nutshell.pod6
Expand Up @@ -621,7 +621,7 @@ of a list, or in passing arguments to a sub that expects a flat list of
KEY, VALUE, KEY, VALUE, then continuing to use C«=>» may break your code.
The easiest workaround is to change the fat comma to a regular comma, and
manually add quotes to its left-hand side. Or, you can change the sub's API
to L<slurp a hash|/type/Signature#Slurpy_(A.K.A._Variadic)_Parameters>.
to L<slurp a hash|/type/Signature#Slurpy_(A.K.A._variadic)_parameters>.
A better long-term solution is to change the sub's API to
expect L<Pair|/type/Pair>s; however, this requires you to change
all sub calls at once.
Expand Down
2 changes: 1 addition & 1 deletion doc/Language/5to6-perlop.pod6
Expand Up @@ -21,7 +21,7 @@ equivalents, please see the L<Perl 6 documentation|/language/operators>.
The operator precedence table is somewhat different in Perl 6 than it is in
Perl 5, so it will not be detail here. If you need to know the precedence and
associativity of a given operator in Perl 6, refer to
L<Operator Precedence|/language/operators#Operator_Precedence>.
L<Operator Precedence|/language/operators#Operator_precedence>.
=head2 Terms and list operators
Expand Down
2 changes: 1 addition & 1 deletion doc/Language/5to6-perlvar.pod6
Expand Up @@ -377,7 +377,7 @@ Does not exist in Perl 6, but you can get the same information using C<$/[*-
If you want to I<understand> why that works, you can look at these documents:
=item L<[ ] routine|/routine/%5b%20%5d#language_documentation_operators>
=item L<[ ] routine|/routine/%5b%20%5d#language_documentation_Operators>
=item L<Whatever|/type/Whatever>
Expand Down
4 changes: 2 additions & 2 deletions doc/Language/classtut.pod6
Expand Up @@ -123,7 +123,7 @@ say Str-with-ID.new(string => 'Second').ID; # OUTPUT: «1»
In this case, we need to compute C<$.ID> from the value of a counter that is a
class variable, C<$.counter>, thus we simply assign a value to it and increment
the counter at the same time. Please check also
L<this section on C<TWEAK> in the Object Orientaion (OO) document|/language/objects#index-entry-TWEAK>
L<this section on C<TWEAK> in the Object Orientation (OO) document|/language/objects#index-entry-TWEAK>
for the mechanics of object construction.
=head1 Starting with class
Expand Down Expand Up @@ -758,7 +758,7 @@ find out via introspection.
Some classes might need its own version of C<gist>, which overrides the terse
way it is printed when called to provide a default representation of the class.
For instance, L<exceptions|/language/exceptions#Uncaught_Exceptions> might want
For instance, L<exceptions|/language/exceptions#Uncaught_exceptions> might want
to write just the C<payload> and not the full object so that it is clearer what
has happened. But you can do that with every class:
Expand Down
2 changes: 1 addition & 1 deletion doc/Language/containers.pod6
Expand Up @@ -378,7 +378,7 @@ You'll also need to initialize the variable in the declaration, it can't be
left undefined after all.
It's also possible to have this constraint enforced in all variables declared
in a scope with the L<default defined variables pragma|/language/variables#Default_Defined_Variables_Pragma>.
in a scope with the L<default defined variables pragma|/language/variables#Default_defined_variables_pragma>.
People coming from other languages where variables are always defined will
want to have a look.
Expand Down
38 changes: 19 additions & 19 deletions doc/Language/control.pod6
Expand Up @@ -40,7 +40,7 @@ executed.
Unless it stands alone as a statement, a block simply creates a closure. The
statements inside are not executed immediately. Closures are another topic
and how they are used is explained
L<elsewhere|/language/functions#Blocks_and_Lambdas>. For now it is just
L<elsewhere|/language/functions#Blocks_and_lambdas>. For now it is just
important to understand when blocks run and when they do not:
=for code
Expand Down Expand Up @@ -93,7 +93,7 @@ is by writing C<do> before it:
# This dies half of the time
do { say "Heads I win, tails I die."; Bool.pick } or die; say "I win.";
Note that you need a space between the do and the block.
Note that you need a space between the C<do> and the block.
The whole C<do {...}> evaluates to the final value of the block. The block
will be run when that value is needed in order to evaluate the rest of the
Expand Down Expand Up @@ -195,11 +195,10 @@ if 0 { say "no" }; else { say "yes" } ; # syntax error
if 0 { say "no" }
else { say "yes" } ; # says "yes"
Additional conditions may be sandwiched between the C<if> and the
C<else> using C<elsif>. An extra condition will only be evaluated
if all the conditions before it were false, and only the block next to
the first true condition will be run. You can end with an C<elsif>
instead of an C<else> if you want.
Additional conditions may be sandwiched between the C<if> and the C<else> using
C<elsif>. An extra condition will only be evaluated if all the conditions
before it were false, and only the block next to the first true condition will
be run. You can end with an C<elsif> instead of an C<else> if you want.
if 0 { say "no" } elsif False { say "NO" } else { say "yes" } # says "yes"
if 0 { say "no" } elsif True { say "YES" } else { say "yes" } # says "YES"
Expand Down Expand Up @@ -365,7 +364,8 @@ say "foo" when X; # if X is true statement is executed
=head1 X<for|control flow, for>
The C<for> loop iterates over a list, running the statements inside a L<block|/type/Block>
The C<for> loop iterates over a list, running the statements inside a
L<block|/type/Block>
once on each iteration. If the block takes parameters, the elements of the
list are provided as arguments.
Expand All @@ -374,7 +374,7 @@ list are provided as arguments.
for @foo { .print } # same thing, because .print implies a $_ argument
for @foo { 42.print } # prints 42 as many times as @foo has elements
Pointy block syntax or a L<placeholder|/language/variables#The_^_Twigil>
Pointy block syntax or a L<placeholder|/language/variables#The_^_twigil>
may be used to name the parameter, of course.
my @foo = 1..3;
Expand Down Expand Up @@ -424,9 +424,9 @@ A for loop can produce a C<List> of the values produced by each run of the
attached block. To capture these values, put the for loop in parenthesis or
assign them to an array:
(for 1, 2, 3 { $_ * 2 }).say; # says "(2 4 6)"
my @a = do for 1, 2, 3 { $_ * 2 }; @a.say; # says "[2 4 6]"
my @b = (for 1, 2, 3 { $_ * 2 }); @a.say; # same thing
(for 1, 2, 3 { $_ * 2 }).say; # OUTPUT «(2 4 6)␤»
my @a = do for 1, 2, 3 { $_ * 2 }; @a.say; # OUTPUT «[2 4 6]␤»
my @b = (for 1, 2, 3 { $_ * 2 }); @b.say; # OUTPUT: «[2 4 6]␤»
=head1 X<gather/take|control flow,gather take>
Expand Down Expand Up @@ -465,8 +465,8 @@ For example
# 2
C<gather/take> is scoped dynamically, so you can call C<take> from subs or methods that are called
from within C<gather>:
C<gather/take> is scoped dynamically, so you can call C<take> from subs or
methods that are called from within C<gather>:
sub weird(@elems, :$direction = 'forward') {
my %direction = (
Expand Down Expand Up @@ -681,8 +681,8 @@ run of the attached block if it appears in lists:
my @a = (loop ( my $j = 0; $j++ < 3;) { $j * 2 }); @a.say; # OUTPUT: «[2 4 6]␤»
my @b = do loop ( my $k = 0; $k++ < 3;) { $k * 2 }; @b.say; # same thing
Unlike a C<for> loop, one should not rely on whether returned values are produced
lazily, for now. It would probably be best to use C<eager> to guarantee that a
Unlike a C<for> loop, one should not rely on whether returned values are
produced lazily. It would probably be best to use C<eager> to guarantee that a
loop whose return value may be used actually runs:
sub heads-in-a-row {
Expand Down Expand Up @@ -778,9 +778,9 @@ All these forms may produce a return value the same way C<loop> does.
=head1 X<return|control flow, return>
The sub C<return> will stop execution of a subroutine or method, run all
relevant L<phasers|/language/phasers#Block_Phasers> and provide the given
relevant L<phasers|/language/phasers#Block_phasers> and provide the given
return value to the caller. The default return value is C<Nil>. If a return
L<type constraint|/type/Signature#Constraining_Return_Types> is provided it
L<type constraint|/type/Signature#Constraining_return_types> is provided it
will be checked unless the return value is C<Nil>. If the type check fails the
exception L<X::TypeCheck::Return|/type/X::TypeCheck::Return> is thrown. If it
passes a control exception is raised and can be caught with
Expand Down Expand Up @@ -818,7 +818,7 @@ The same rules as for C<return> regarding phasers and control exceptions apply.
Leaves the current routine and returns the provided
L<Exception|/type/Exception> or C<Str> wrapped inside a
L<Failure|/type/Failure>, after all relevant
L<phasers|/language/phasers#Block_Phasers> are executed. If the caller
L<phasers|/language/phasers#Block_phasers> are executed. If the caller
activated fatal exceptions via the pragma C<use fatal;>, the exception is
thrown instead of being returned as a C<Failure>.
Expand Down
4 changes: 2 additions & 2 deletions doc/Language/exceptions.pod6
Expand Up @@ -199,7 +199,7 @@ the C<die> statement, but not the C<E> exception. In the absence of a C<CATCH>
block, all exceptions will be contained and dropped, as indicated above.
C<resume> will resume execution right after the exception has been thrown; in
this case, in the C<die> statement. Please consult the section on
L<resuming of exceptions|/language/exceptions#Resuming_of_Exceptions>
L<resuming of exceptions|/language/exceptions#Resuming_of_exceptions>
for more information on this.
A C<try>-block is a normal block and as such treats its last statement as the
Expand Down Expand Up @@ -372,7 +372,7 @@ printing a backtrace along with the message:
Control exceptions are thrown by certain L<keywords|/language/phasers#CONTROL>
and are handled either automatically or by the appropriate
L<phaser|/language/phasers#Loop_Phasers>. Any unhandled control exception is
L<phaser|/language/phasers#Loop_phasers>. Any unhandled control exception is
converted to a normal exception.
{ return; CATCH { default { $*ERR.say: .^name, ': ',.Str } } }
Expand Down
9 changes: 5 additions & 4 deletions doc/Language/faq.pod6
Expand Up @@ -21,11 +21,12 @@ Yes with the Rakudo 2015.12 implementation version on December 25th 2015.
=head2 Is there a Perl 6 version 6.0.0?
No. The first stable language specification version is v6.c ("Christmas").
Future versions of the spec may have point releases (e.g. v6.c.2) or major
releases (e.g., v6.d).
No. The first stable language specification version is v6.c
("Christmas"). Future versions of the spec may have point releases (e.g.
v6.c.2) or major releases (e.g., v6.d).
Running C<perl6 -v> will display the language version your compiler implements:
Running C<perl6 -v> will display the language version your compiler
implements:
=for code :lang<shell>
$ perl6 -v
Expand Down
2 changes: 1 addition & 1 deletion doc/Language/functions.pod6
Expand Up @@ -301,7 +301,7 @@ the call. Therefore a multi candidate with named parameters will be given
precedence.
For more information about type constraints see the documentation
for the L<Signature|/type/Signature#Type_Constraints> class.
for the L<Signature|/type/Signature#Type_constraints> class.
multi as-json(Bool $d) { $d ?? 'true' !! 'false'; }
multi as-json(Real $d) { ~$d }
Expand Down

0 comments on commit d1bb59e

Please sign in to comment.