Skip to content

Commit

Permalink
Merge pull request #10 from skids/master
Browse files Browse the repository at this point in the history
Clarify when prefix<::> can be used as in-place predeclarator
  • Loading branch information
Konrad Borowski committed Dec 1, 2012
2 parents 749445a + b6a63bf commit fc0e3bd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions S06-routines.pod
Expand Up @@ -805,13 +805,13 @@ order of arguments with the same name. When there are more than one
argument, the C<@> sigil in the parameter list causes the arguments
to be concatenated:

sub fun (Int @x) { ... }
sub fun (Int :@x) { ... }
fun( x => 1, x => 2 ); # @x := (1, 2)
fun( x => (1, 2), x => (3, 4) ); # @x := (1, 2, 3, 4)

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

sub fun (Int $x) { ... }
sub fun (Int :$x) { ... }
fun( x => 1, x => 2 ); # $x := 2
fun( x => (1, 2), x => (3, 4) ); # $x := (3, 4)

Expand Down
10 changes: 6 additions & 4 deletions S10-packages.pod
Expand Up @@ -46,10 +46,12 @@ the file is Perl 5 code.
This form is illegal in a Perl 6 file. If you wish to have a file-scoped package,
either use the brace form or declare it with the C<module> keyword instead.

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

A bare C<package> declarator (without an explicit scope declarator
such as C<my>) declares an C<our> package within the current package
Expand Down
2 changes: 1 addition & 1 deletion S12-objects.pod
Expand Up @@ -1847,7 +1847,7 @@ Such declarational forms are not always convenient; to translate
native enum values back to their names operationally, you can pull
out the enum type's C<EnumMap> and invert it:

constant %dayname := Day.enums.invert;
constant %dayname := day.enums.invert;
%dayname{3} # Wed

=head2 The Enumeration Type
Expand Down

0 comments on commit fc0e3bd

Please sign in to comment.