Skip to content

Commit

Permalink
Improve consistency and completeness of Packages document
Browse files Browse the repository at this point in the history
- Include the output of the say calls in the name interpolation example.
- Make spacing and capitalization consistent.
  • Loading branch information
zopsicle authored and Chloé committed Jul 8, 2019
1 parent 56ce35b commit ce50e11
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions doc/Language/packages.pod6
Expand Up @@ -33,13 +33,13 @@ class Foo {
}
}
my $foo; # simple identifiers
say Foo::Bar.baz; # Calling a method; OUTPUT: «Þor is mighty␤»
say Foo::Bar::zape; # compound identifiers separated by ::; OUTPUT: «zipi␤»
my $foo; # simple identifiers
say Foo::Bar.baz; # calling a method; OUTPUT: «Þor is mighty␤»
say Foo::Bar::zape; # compound identifiers separated by ::; OUTPUT: «zipi␤»
my $bar = 'Bar';
say $Foo::($bar)::quux;# compound identifiers with interpolations; OUTPUT: «42␤»
$42; # numeric names
$!; # certain punctuation variables
say $Foo::($bar)::quux; # compound identifiers with interpolations; OUTPUT: «42␤»
$42; # numeric names
$!; # certain punctuation variables
=end code
X<|::,package>
Expand All @@ -53,7 +53,7 @@ exists.
=begin code
package Foo:ver<0> {};
module Foo:ver<1> {};
say Foo.^ver; OUTPUT: «1␤»
say Foo.^ver; # OUTPUT: «1␤»
=end code
The syntax allows the declared package to use a version, but as a matter of
Expand Down Expand Up @@ -169,10 +169,10 @@ searched last.
Use the C<MY> pseudopackage to limit the lookup to the current lexical scope,
and C<OUR> to limit the scopes to the current package scope.
In the same vein, class and method names can be interpolated too.
In the same vein, class and method names can be interpolated too:
role with-method {
method a-method { return "in-a-method of " ~ $?CLASS.^name };
method a-method { return 'in-a-method of ' ~ $?CLASS.^name };
}
class a-class does with-method {
Expand All @@ -181,16 +181,16 @@ In the same vein, class and method names can be interpolated too.
class b-class does with-method {};
my $what-class='a-class';
my $what-class = 'a-class';
say ::($what-class).a-method;
say ::($what-class).a-method; # OUTPUT: «in-a-method of a-class␤»
$what-class = 'b-class';
say ::($what-class).a-method;
say ::($what-class).a-method; # OUTPUT: «in-a-method of b-class␤»
my $what-method='a-method';
say a-class."$what-method"();
$what-method='another-method';
say a-class."$what-method"();
my $what-method = 'a-method';
say a-class."$what-method"(); # OUTPUT: «in-a-method of a-class␤»
$what-method = 'another-method';
say a-class."$what-method"(); # OUTPUT: «in-another-method␤»
X<|::($c).m>
X<|A."$m"()>
Expand All @@ -203,7 +203,7 @@ package name as a hash:
=for code :skip-test<showcasing syntaxes>
Foo::Bar::{'&baz'} # same as &Foo::Bar::baz
PROCESS::<$IN> # Same as $*IN
PROCESS::<$IN> # same as $*IN
Foo::<::Bar><::Baz> # same as Foo::Bar::Baz
Unlike C<::()> symbolic references, this does not parse the argument for
Expand Down

0 comments on commit ce50e11

Please sign in to comment.