Skip to content

Commit fc0e3bd

Browse files
author
Konrad Borowski
committed
Merge pull request #10 from skids/master
Clarify when prefix<::> can be used as in-place predeclarator
2 parents 749445a + b6a63bf commit fc0e3bd

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

S06-routines.pod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -805,13 +805,13 @@ order of arguments with the same name. When there are more than one
805805
argument, the C<@> sigil in the parameter list causes the arguments
806806
to be concatenated:
807807

808-
sub fun (Int @x) { ... }
808+
sub fun (Int :@x) { ... }
809809
fun( x => 1, x => 2 ); # @x := (1, 2)
810810
fun( x => (1, 2), x => (3, 4) ); # @x := (1, 2, 3, 4)
811811

812812
Other sigils bind only to the I<last> argument with that name:
813813

814-
sub fun (Int $x) { ... }
814+
sub fun (Int :$x) { ... }
815815
fun( x => 1, x => 2 ); # $x := 2
816816
fun( x => (1, 2), x => (3, 4) ); # $x := (3, 4)
817817

S10-packages.pod

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,12 @@ the file is Perl 5 code.
4646
This form is illegal in a Perl 6 file. If you wish to have a file-scoped package,
4747
either use the brace form or declare it with the C<module> keyword instead.
4848

49-
Since there are no barewords in Perl 6, package names must be predeclared,
50-
or use the sigil-like C<::PackageName> syntax to indicate that the type will
51-
be supplied some other way. The C<::> prefix does not imply globalness as
52-
it does in Perl 5. (Use C<GLOBAL::> for that.)
49+
Since there are no barewords in Perl 6, package names must be predeclared.
50+
Alternatively, the sigil-like C<::PackageName> syntax may be used to indicate
51+
that the type will be supplied some other way, however this syntax is not valid
52+
in declarative scenarios, especially parameter lists where it has entirely
53+
different semantics. The C<::> prefix does not imply globalness as it does in
54+
Perl 5. (Use C<GLOBAL::> for that.)
5355

5456
A bare C<package> declarator (without an explicit scope declarator
5557
such as C<my>) declares an C<our> package within the current package

S12-objects.pod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1847,7 +1847,7 @@ Such declarational forms are not always convenient; to translate
18471847
native enum values back to their names operationally, you can pull
18481848
out the enum type's C<EnumMap> and invert it:
18491849

1850-
constant %dayname := Day.enums.invert;
1850+
constant %dayname := day.enums.invert;
18511851
%dayname{3} # Wed
18521852

18531853
=head2 The Enumeration Type

0 commit comments

Comments
 (0)