@@ -33,13 +33,13 @@ class Foo {
33
33
}
34
34
}
35
35
36
- my $foo; # simple identifiers
37
- say Foo::Bar.baz; # Calling a method; OUTPUT: «Þor is mighty»
38
- say Foo::Bar::zape; # compound identifiers separated by ::; OUTPUT: «zipi»
36
+ my $foo; # simple identifiers
37
+ say Foo::Bar.baz; # calling a method; OUTPUT: «Þor is mighty»
38
+ say Foo::Bar::zape; # compound identifiers separated by ::; OUTPUT: «zipi»
39
39
my $bar = 'Bar';
40
- say $Foo::($bar)::quux;# compound identifiers with interpolations; OUTPUT: «42»
41
- $42; # numeric names
42
- $!; # certain punctuation variables
40
+ say $Foo::($bar)::quux; # compound identifiers with interpolations; OUTPUT: «42»
41
+ $42; # numeric names
42
+ $!; # certain punctuation variables
43
43
= end code
44
44
45
45
X < |::,package >
@@ -53,7 +53,7 @@ exists.
53
53
= begin code
54
54
package Foo:ver<0> {};
55
55
module Foo:ver<1> {};
56
- say Foo.^ver; OUTPUT: «1»
56
+ say Foo.^ver; # OUTPUT: «1»
57
57
= end code
58
58
59
59
The syntax allows the declared package to use a version, but as a matter of
@@ -169,10 +169,10 @@ searched last.
169
169
Use the C < MY > pseudopackage to limit the lookup to the current lexical scope,
170
170
and C < OUR > to limit the scopes to the current package scope.
171
171
172
- In the same vein, class and method names can be interpolated too.
172
+ In the same vein, class and method names can be interpolated too:
173
173
174
174
role with-method {
175
- method a-method { return " in-a-method of " ~ $?CLASS.^name };
175
+ method a-method { return ' in-a-method of ' ~ $?CLASS.^name };
176
176
}
177
177
178
178
class a-class does with-method {
@@ -181,16 +181,16 @@ In the same vein, class and method names can be interpolated too.
181
181
182
182
class b-class does with-method {};
183
183
184
- my $what-class= 'a-class';
184
+ my $what-class = 'a-class';
185
185
186
- say ::($what-class).a-method;
186
+ say ::($what-class).a-method; # OUTPUT: «in-a-method of a-class»
187
187
$what-class = 'b-class';
188
- say ::($what-class).a-method;
188
+ say ::($what-class).a-method; # OUTPUT: «in-a-method of b-class»
189
189
190
- my $what-method= 'a-method';
191
- say a-class."$what-method"();
192
- $what-method= 'another-method';
193
- say a-class."$what-method"();
190
+ my $what-method = 'a-method';
191
+ say a-class."$what-method"(); # OUTPUT: «in-a-method of a-class»
192
+ $what-method = 'another-method';
193
+ say a-class."$what-method"(); # OUTPUT: «in-another-method»
194
194
195
195
X < |::($c).m >
196
196
X < |A."$m"() >
@@ -203,7 +203,7 @@ package name as a hash:
203
203
204
204
= for code :skip-test<showcasing syntaxes>
205
205
Foo::Bar::{'&baz'} # same as &Foo::Bar::baz
206
- PROCESS::<$IN> # Same as $*IN
206
+ PROCESS::<$IN> # same as $*IN
207
207
Foo::<::Bar><::Baz> # same as Foo::Bar::Baz
208
208
209
209
Unlike C < ::() > symbolic references, this does not parse the argument for
0 commit comments