Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Clarifies scopes of classes and subs, closes #2848
  • Loading branch information
JJ committed Jun 10, 2019
1 parent ffdd098 commit e9e1412
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions doc/Language/packages.pod6
Expand Up @@ -13,10 +13,10 @@ TODO
=end comment
Packages are nested namespaces of named program elements.
L<Modules|/language/module-packages>, classes, grammars, and others are
types of packages. Like files in a directory, you can generally refer to
named elements with their short-name if they are local, or with the
longer name that includes the namespace to disambiguate.
L<Modules|/language/module-packages>, classes, grammars, and others are types of
packages. Like files in a directory, you can generally refer to named elements
with their short-name if they are local, or with the longer name that includes
the namespace to disambiguate as long as their scope allows that.
=head1 Names
Expand Down Expand Up @@ -72,8 +72,10 @@ alternate way to write this is:
Foo::Bar::<$quux>
(This does not work with the C<&zape> variable) The name is resolved at
compile time because the variable name is a constant.
This does not work with the C<Foo«&zape»> variable, since C<sub>s, by default,
have lexical scope. The name is resolved at compile time because the variable
name is a constant. We can access the rest of the variables in C<Bar> (as shown
in the example above) since classes, by default, have package scope.
If the name part before C<::> is null, it means the package is unspecified and
must be searched for. Generally this means that an initial C<::> following the
Expand Down

0 comments on commit e9e1412

Please sign in to comment.