Skip to content

Commit

Permalink
Wrap overly-long lines to aid readability
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Cochrane committed Feb 24, 2015
1 parent 92d7bd5 commit 7aff36d
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions lib/Language/5to6.pod
Expand Up @@ -136,7 +136,10 @@ allowed:
my @books = $xml.parse-file($file)\ # some comment
.findnodes("/library/book");
See also L<S03#Minimal whitespace DWIMmery|http://design.perl6.org/S03.html#Minimal_whitespace_DWIMmery> and L<S04#Statement parsing|http://design.perl6.org/S04.html#Statement_parsing> in the Perl 6 design docs.
See also L<S03#Minimal whitespace
DWIMmery|http://design.perl6.org/S03.html#Minimal_whitespace_DWIMmery> and
L<S04#Statement parsing|http://design.perl6.org/S04.html#Statement_parsing>
in the Perl 6 design docs.
=head3 Sigils
Expand Down Expand Up @@ -248,7 +251,8 @@ variable holding a code object as an argument:
=end item
=begin item
C<&foo;> I<and> C<goto &foo;> I<for re-using the caller's argument list / replacing the caller in the call stack>
C<&foo;> I<and> C<goto &foo;> I<for re-using the caller's argument list /
replacing the caller in the call stack>
sub foo { say "before"; &bar; say "after" } # Perl 5
sub foo { say "before"; bar(|@_); say "after" } # Perl 6 - have to be explicit
Expand Down Expand Up @@ -503,7 +507,8 @@ expect Pairs. However, this requires you to change all sub calls at once.
=head3 C<? :> Ternary operator
Now spelled with two question marks instead of one question mark, and two exclamation points instead of one colon.
Now spelled with two question marks instead of one question mark, and two
exclamation points instead of one colon.
my $result = ( $score > 60 ) ? 'Pass' : 'Fail'; # Perl 5
my $result = ( $score > 60 ) ?? 'Pass' !! 'Fail'; # Perl 6
Expand Down Expand Up @@ -638,12 +643,15 @@ Parens are optional.
The iteration variable, if any, has been moved from before the list, to
after the list and an added arrow operator.
The iteration variable is now always lexical; C<my> is neither needed nor allowed.
The iteration variable is now always lexical; C<my> is neither needed nor
allowed.
In Perl 5, the iteration variable is a read-write alias to the current list element.
In Perl 5, the iteration variable is a read-write alias to the current list
element.
In Perl 6, that alias is read-only (for safety), unless you change C«->» to C«<->».
When translating, inspect the use of the loop variable to decide if read-write is needed.
In Perl 6, that alias is read-only (for safety), unless you change C«->» to
C«<->». When translating, inspect the use of the loop variable to decide if
read-write is needed.
for my $car (@cars) {...} # Perl 5; read-write
for @cars -> $car {...} # Perl 6; read-only
Expand Down Expand Up @@ -723,7 +731,8 @@ require you to add the optional C<m> on a plain match like C«/abc/».
=head3 Add :P5 or :Perl5 adverb
If the actual regex is complex, you may want to use it as-is, by adding the C<P5> modifier.
If the actual regex is complex, you may want to use it as-is, by adding the
C<P5> modifier.
next if $line =~ m/[aeiou]/ ; # Perl 5
next if $line ~~ m:P5/[aeiou]/ ; # Perl 6, using P5 modifier
Expand Down Expand Up @@ -763,7 +772,8 @@ For look-around assertions:
(Unrelated to <> syntax, the "lookaround" C</foo\Kbar/> becomes C</foo <( bar /> )>
=item C<(?(?{condition))yes-pattern|no-pattern)> becomes C«[ <?{condition}> yes-pattern | no-pattern ]»
=item C<(?(?{condition))yes-pattern|no-pattern)> becomes C«[ <?{condition}>
yes-pattern | no-pattern ]»
=head3 Longest token matching (LTM) displaces alternation
Expand Down

0 comments on commit 7aff36d

Please sign in to comment.